-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation error p4 #45
Comments
Can't I use a large number of operations in P4? It can be compiled in bmv2, but not in t4p4s |
this is error p4 to JSON cost:23.00 milliseconds JSON to IR cost:41.00 milliseconds Exception: 'id' |
@henanda123 , can we run p4 program directly here as on p4c? I mean, what's the compile command? |
hello! Help: when I use t4p4s compile my P4, if I do not add "new_probability = (bit<33>) ((int<33>) new_probability + (int<33>) delta); ", the compilation is normal and there is no error. If I add "new_probability = (bit<33>) ((int<33>) new_probability + (int<33>) delta); ", the compilation reports an error, who can tell my why?
this is my *.p4;
#include <core.p4>
#define V1MODEL_VERSION 20180101
#include <v1model.p4>
#define WRITE_REG(r, v) r.write((bit<32>)standard_metadata.egress_port, v);
#define READ_REG(r, v) r.read(v,(bit<32>)standard_metadata.egress_port);
#define CAP(c, v, a, t){ if (v > c) a = c; else a = (t)v; }
const bit<16> TYPE_IPV4 = 0x800;
const bit<32> MAX_RND = 0xFFFFFFFF;
/*************************************************************************
*********************** H E A D E R S ***********************************
*************************************************************************/
typedef bit<9> egressSpec_t;
typedef bit<48> macAddr_t;
typedef bit<32> ip4Addr_t;
//input parameters
typedef int<32> alpha_t;
typedef int<32> beta_t;
typedef int<32> delay_t;
typedef bit<5> interval_t;
@controller_header("packet_in") header packet_in_header_t {
bit<9> ingress_port;
bit<7> _pad;
}
@controller_header("packet_out") header packet_out_header_t {
bit<9> egress_port;
bit<7> _pad;
}
header ethernet_t {
macAddr_t dstAddr;
macAddr_t srcAddr;
bit<16> etherType;
}
header ipv4_t {
bit<4> version;
bit<4> ihl;
bit<6> diffserv;
bit<2> ecn;
bit<16> totalLen;
// bit<16> identification; // repurpose identification field...
bit<5> drops; // up to 31 previous packets dropped
bit<11> qdelay_ms; // up to 2047ms queue delay
bit<3> flags;
bit<13> fragOffset;
bit<8> ttl;
bit<8> protocol;
bit<16> hdrChecksum;
ip4Addr_t srcAddr;
ip4Addr_t dstAddr;
}
struct metadata {
bit<1> mark_drop;
int<32> new_probability;
}
struct headers {
ethernet_t ethernet;
ipv4_t ipv4;
}
error { IPHeaderTooShort }
/*************************************************************************
************ C H E C K S U M V E R I F I C A T I O N *************
*************************************************************************/
control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
apply {
}
}
/*************************************************************************
************* C H E C K S U M C O M P U T A T I O N **************
*************************************************************************/
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
apply {
//update_checksum(hdr.ipv4.isValid(), { hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.dscp, hdr.ipv4.ecn, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }, hdr.ipv4.hdrChecksum, HashAlgorithm.csum16);
}
}
/*************************************************************************
*********************** P A R S E R ***********************************
*************************************************************************/
parser MyParser(packet_in packet,
out headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
}
/*************************************************************************
************** I N G R E S S P R O C E S S I N G *******************
*************************************************************************/
control MyIngress(inout headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
}
/*************************************************************************
**************** E G R E S S P R O C E S S I N G *******************
*************************************************************************/
control MyEgress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
}
/*************************************************************************
*********************** D E P A R S E R *******************************
*************************************************************************/
control MyDeparser(packet_out packet, in headers hdr) {
apply {
packet.emit(hdr.ethernet);
packet.emit(hdr.ipv4);
}
}
V1Switch(MyParser(), MyVerifyChecksum(), MyIngress(), MyEgress(), MyComputeChecksum(), MyDeparser()) main;
The text was updated successfully, but these errors were encountered: