Commit 6be7824c authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

sim: update packet sink/source to send/receive RX OOB

parent adcb8584
......@@ -64,7 +64,7 @@ class EthPacket;
is_hp = 0;
has_crc = 0;
oob_type = NONE;
payload = new[size](payload);
payload = new[size](payload);
endfunction // new
......@@ -180,6 +180,10 @@ class EthPacket;
if(oob_type == TX_FID && (b.ts.frame_id != ts.frame_id))
return 0;
if(oob_type == RX_TIMESTAMP && (b.ts.ts_r != ts.ts_r) && (b.ts.ts_f !=
ts.ts_f))
return 0;
end
return 1;
......@@ -233,6 +237,10 @@ is_hp ? "H" : " ", has_crc ? "C" : " ");
$sformat(tmp, "TxOOB: %x", ts.frame_id);
str = {str, tmp};
end
if(oob_type == RX_TIMESTAMP) begin
$sformat(tmp, "RxOOB: %x, %x", ts.ts_f, ts.ts_r);
str = {str, tmp};
end
$display(str);
hexdump(payload);
......@@ -264,6 +272,7 @@ class EthPacketGenerator;
protected int r_flags;
protected int m_current_frame_id;
protected int current_ts;
protected int cur_seq_id;
function new();
......@@ -271,6 +280,7 @@ class EthPacketGenerator;
min_size = 64;
max_size = 128;
m_current_frame_id = 0;
current_ts = 0;
template = new;
cur_seq_id = 0;
......@@ -361,6 +371,13 @@ class EthPacketGenerator;
pkt.oob_type = TX_FID;
end
if(r_flags & RX_OOB) begin
pkt.oob_type = RX_TIMESTAMP;
pkt.ts.port_id = 0;
pkt.ts.ts_r = ++current_ts;
pkt.ts.ts_f = current_ts;
end
pkt.size = len + 14; //payload + header
return pkt;
......
......@@ -48,13 +48,18 @@ class WBPacketSink extends EthPacketSink;
pkt.oob_type = TX_FID;
pkt.ts.frame_id = oob & 'hffff;
end
else if (size == 3 && (oob >> 46) == WRF_OOB_RX_TIMESTAMP)
else if (size == 3 && (oob >> 44) == WRF_OOB_RX_TIMESTAMP)
begin
// $display("GotRXOOB");
end else begin
$error("Invalid OOB!");
$stop;
pkt.oob_type = RX_TIMESTAMP;
pkt.ts.port_id = (oob >> 32) & 'h1F;
pkt.ts.ts_f = (oob >> 28) & 'h0F;
pkt.ts.ts_r = oob & 'h0FFFFFFF;
end
else begin
$display("Invalid OOB!");
//$error("Invalid OOB!");
//$stop;
end
......
......@@ -43,6 +43,12 @@ class WBPacketSource extends EthPacketSource;
oob[0] = {WRF_OOB_TX_FID, 12'b0};
oob[1] = pkt.ts.frame_id;
end
RX_TIMESTAMP: begin
oob = new[3];
oob[0] = {WRF_OOB_RX_TIMESTAMP, 1'b1, 6'b0, pkt.ts.port_id[4:0]};
oob[1] = {pkt.ts.ts_f, pkt.ts.ts_r[27:16]};
oob[2] = pkt.ts.ts_r[15:0];
end
endcase // case (pkt.oob_type)
return oob;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment