Skip to content

Commit

Permalink
scoreboard: Added features
Browse files Browse the repository at this point in the history
- Added feature to clear data streams to be able to reuse the scoreboard in run-time
- Added empty streams event checking ability

Signed-off-by: Istvan-Zsolt Szekely <[email protected]>
  • Loading branch information
IstvanZsSzekely committed Mar 6, 2024
1 parent 66738bd commit 21ca43f
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions common/sv/scoreboard.sv
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ package scoreboard_pkg;
bit enabled;
xil_uint error_cnt;
xil_uint comparison_cnt;

event end_of_first_cycle;
event byte_streams_empty;

// constructor
function new(input string name);
Expand All @@ -51,7 +53,7 @@ package scoreboard_pkg;
this.source_byte_stream_size = 0;
this.sink_byte_stream_size = 0;

endfunction /* new */
endfunction: new

// connect the analysis ports of the monitor to the scoreboard
function void set_source_stream(
Expand All @@ -61,7 +63,7 @@ package scoreboard_pkg;
this.source_tm = source_tm;
this.source_mailbox = source_mailbox;

endfunction /* set_source_stream */
endfunction: set_source_stream

function void set_sink_stream(
x_monitor sink_tm,
Expand All @@ -70,7 +72,7 @@ package scoreboard_pkg;
this.sink_tm = sink_tm;
this.sink_mailbox = sink_mailbox;

endfunction /* set_sink_stream */
endfunction: set_sink_stream

// run task
task run();
Expand All @@ -83,7 +85,7 @@ package scoreboard_pkg;
// verify_tx_cyclic();
join_none

endtask /* run */
endtask: run

// set sink type
function void set_sink_type(input bit sink_type);
Expand All @@ -94,13 +96,24 @@ package scoreboard_pkg;
`ERROR(("ERROR Scoreboard: Can not configure sink_type while scoreboard is running."));
end

endfunction
endfunction: set_sink_type

// clear source and sink byte streams
function void clear_streams();
source_byte_stream.delete();
sink_byte_stream.delete();
endfunction: clear_streams

// get sink type
function bit get_sink_type();
return this.sink_type;
endfunction

// wait until source and sink byte streams are empty, full check
task wait_until_complete();
@byte_streams_empty;
endtask

// get transaction data from source monitor
task get_source_transaction();

Expand Down Expand Up @@ -164,8 +177,12 @@ package scoreboard_pkg;
end else begin
this.comparison_cnt++;
end
end else
end else begin
if ((this.source_byte_stream_size == 0) &&
(this.sink_byte_stream_size == 0))
->byte_streams_empty;
#1step;
end
end

endtask /* compare_transaction */
Expand Down

0 comments on commit 21ca43f

Please sign in to comment.