-
Notifications
You must be signed in to change notification settings - Fork 31
Sub Extern Function
Home || Extern Funtion Library
Description - Two different RAW atoms. One is performed if the provided predicate is true, the other is performed if the predicate is false.
Instantiation:
#define REG_READ 8w0
#define REG_WRITE 8w1
#define REG_ADD 8w2
#define REG_SUB 8w3
#define EQ_RELOP 8w0
#define NEQ_RELOP 8w1
#define GT_RELOP 8w2
#define LT_RELOP 8w3
@Xilinx_MaxLatency(1)
@Xilinx_ControlWidth(width(T))
extern void <reg_name>_reg_sub<T, D>(in T index_2,
in D newVal_2,
in D incVal_2,
in bit<8> opCode_2,
in T index_1,
in D newVal_1,
in D incVal_1,
in bit<8> opCode_1,
in T index_comp,
in D compVal,
in bit<8> relOp,
out D result,
out bit<1> boolean);
-
index_2
- the index to access for the 2nd RAW atom. -
newVal_2
- the new value to write into the register at index_2 for the second RAW atom. This field is only used ifopCode_2
== REG_WRITE. -
incVal_2
- the amount to add to the register at the index_2 for the second RAW atom. This field is only used ifopCode_2
== REG_ADD. -
opCode_2
- defines the operation to perform for the 2nd RAW atom: REG_READ, REG_WRITE, REG_ADD, or REG_SUB. -
index_1
- the index to access for the 1st RAW atom. -
newVal_1
- the new value to write into the register at index_1 for the 1st RAW atom. This field is only used ifopCode_1
== REG_WRITE. -
incVal_1
- the amount to add to the register at the index_1 for the 1st RAW atom. This field is only used ifopCode_1
== REG_ADD. -
opCode_1
- defines the operation to perform for the 1st RAW atom: REG_READ, REG_WRITE, REG_ADD, or REG_SUB. -
index_comp
- the index to use to perform the comparison for the predicate. -
compVal
- the value to compare to the current value of the register atindex_comp
-
relOp
- the operation to use to comparecompVal
to the current value of the register atindex_comp
.compVal
andrelOp
together define the predicate that decides whether or not the register value will be modified. If the predicate is true then perform RAW 1 otherwise perform RAW 2. -
result
- the latest value of the register at either index_1 or index_2 depending on whether or not the predicate is true or false respectively. -
boolean
- bit that indicates whether or not the predicate was true (1) or false (0) -
@Xilinx_MaxLatency
- allows P4 programmer to specify the number of clock cycles to complete the extern operation. -
@Xilinx_ControlWidth
- allows P4 programmer to specify the width of the address space allocated to this register. This usually be equal to the width of the index field so that the control-plane can access all register entries.