Skip to content

Commit 460926c

Browse files
m_axis_sequencer: Updated keep signal (#117)
* m_axis_sequencer: Updated keep signal - Added support for non-valid byte transmission using keep - Added support for the monitor to drop non-valid signals for scoreboard - By default all keep bits are valid when the sequencer is initialized Signed-off-by: Istvan-Zsolt Szekely <istvan.szekely@analog.com>
1 parent aeb8aee commit 460926c

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

common/sv/m_axis_sequencer.sv

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ package m_axis_sequencer_pkg;
6565

6666
protected bit descriptor_gen_mode; // 0 - get descriptor from test;
6767
// 1 - autogenerate descriptor based on the first descriptor from test until aborted
68+
protected bit keep_all; // 0 - bytes can be set to be invalid
69+
// 1 - all bytes are always valid, data is generated only for the set part
6870

6971
protected int byte_count;
7072

@@ -102,6 +104,7 @@ package m_axis_sequencer_pkg;
102104
this.descriptor_delay = 0;
103105
this.stop_policy = STOP_POLICY_DATA_BEAT;
104106
this.queue_empty_sig = 1;
107+
this.keep_all = 1;
105108
endfunction: new
106109

107110

@@ -168,6 +171,20 @@ package m_axis_sequencer_pkg;
168171
`INFOV(("Descriptor delay configured"), 55);
169172
endfunction: set_descriptor_delay
170173

174+
// set all bytes valid in a sample, sets keep to 1
175+
function void set_keep_all();
176+
if (enabled)
177+
`ERROR(("Sequencer must be disabled before configuring keep all parameter"));
178+
this.keep_all = 1;
179+
endfunction: set_keep_all
180+
181+
// bytes in a sample may not be valid, sets some bits of keep to 0
182+
function void set_keep_some();
183+
if (enabled)
184+
`ERROR(("Sequencer must be disabled before configuring keep all parameter"));
185+
this.keep_all = 0;
186+
endfunction: set_keep_some
187+
171188
// create transfer descriptor
172189
function void add_xfer_descriptor(
173190
input int bytes_to_generate,
@@ -297,6 +314,7 @@ package m_axis_sequencer_pkg;
297314
super.new();
298315

299316
this.agent = agent;
317+
this.agent.vif_proxy.set_no_insert_x_when_keep_low(1);
300318
endfunction: new
301319

302320

@@ -336,19 +354,26 @@ package m_axis_sequencer_pkg;
336354

337355
`INFOV(("packetize start"), 55);
338356
byte_per_beat = AXIS_VIP_DATA_WIDTH/8;
339-
data = new[byte_per_beat];
340-
keep = new[byte_per_beat];
341357
descriptor = descriptor_q.pop_front();
342358

343359
// put a copy of the descriptor back into the queue and continue processing
344360
if (this.descriptor_gen_mode == 1 && enabled)
345361
descriptor_q.push_back(descriptor);
346362

347363
packet_length = descriptor.num_bytes / byte_per_beat;
364+
if (packet_length*byte_per_beat < descriptor.num_bytes)
365+
packet_length++;
366+
367+
if (keep_all)
368+
descriptor.num_bytes = packet_length*byte_per_beat;
348369

349370
for (int tc=0; tc<packet_length; tc++) begin : packet_loop
371+
data = new[byte_per_beat];
372+
for (int i=0; i<byte_per_beat; i++)
373+
data[i] = 'd0;
374+
keep = new[byte_per_beat];
350375

351-
for (int i=0; i<byte_per_beat; i++) begin
376+
for (int i=0; i<byte_per_beat && (keep_all || tc*byte_per_beat+i<descriptor.num_bytes); i++) begin
352377
case (data_gen_mode)
353378
DATA_GEN_MODE_TEST_DATA:
354379
// block transfer until we get data from byte stream queue

common/sv/x_monitor.sv

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ package x_monitor_pkg;
7676
// analysis port from the monitor
7777
protected xil_analysis_port #(axi_monitor_transaction) axi_ap;
7878

79+
protected T agent;
80+
7981
protected int axi_byte_stream_size;
8082

8183
// constructor
@@ -85,7 +87,8 @@ package x_monitor_pkg;
8587

8688
this.enabled = 0;
8789

88-
this.axi_ap = agent.monitor.item_collected_port;
90+
this.agent = agent;
91+
this.axi_ap = this.agent.monitor.item_collected_port;
8992

9093
this.axi_byte_stream_size = 0;
9194

@@ -97,22 +100,29 @@ package x_monitor_pkg;
97100

98101
axi_monitor_transaction transaction;
99102
xil_axi_data_beat data_beat;
103+
xil_axi_strb_beat strb_beat;
100104
int num_bytes;
101105
logic [7:0] axi_byte;
102106

103107
forever begin
104108
this.get_key();
105109
this.axi_ap.get(transaction);
106-
if (bit'(transaction.get_cmd_type()) == bit'(operation_type)) begin
110+
if (bit'(transaction.get_cmd_type()) == operation_type) begin
107111
this.put_key();
108112
num_bytes = transaction.get_data_width()/8;
109113
for (int i=0; i<(transaction.get_len()+1); i++) begin
110114
data_beat = transaction.get_data_beat(i);
115+
strb_beat = transaction.get_strb_beat(i);
111116
for (int j=0; j<num_bytes; j++) begin
112117
axi_byte = data_beat[j*8+:8];
113118
// put each beat into byte queues
114-
this.mailbox.put(axi_byte);
115-
this.axi_byte_stream_size++;
119+
if (operation_type == READ_OP) begin
120+
this.mailbox.put(axi_byte);
121+
this.axi_byte_stream_size++;
122+
end else if (strb_beat[j] || !this.agent.vif_proxy.C_AXI_HAS_WSTRB) begin
123+
this.mailbox.put(axi_byte);
124+
this.axi_byte_stream_size++;
125+
end
116126
end
117127
`INFOV(("Caught an AXI4 transaction: %d", this.axi_byte_stream_size), 100);
118128
this.transaction_captured();
@@ -152,7 +162,6 @@ package x_monitor_pkg;
152162
this.tx_sink_type = CYCLIC;
153163

154164
this.agent = agent;
155-
156165
this.axis_ap = this.agent.monitor.item_collected_port;
157166

158167
endfunction /* new */

0 commit comments

Comments
 (0)