18 protected uvm_component
fts[][string][string];
24 `uvm_component_utils_begin(cl_syoscbs_base)
25 `uvm_field_object(cfg, UVM_DEFAULT)
26 `uvm_component_utils_end
31 function new(string name = "cl_syoscbs_base", uvm_component parent = null);
32 super.new(name, parent);
38 extern
virtual function void
build_phase(uvm_phase phase);
40 extern
virtual function void
report_phase(uvm_phase phase);
49 string queue_names[] = {});
51 string queue_names[] = {});
55 extern
protected virtual function string
create_scb_stats(int unsigned offset,
56 int unsigned first_column_width);
57 extern
virtual function string
create_report(int unsigned offset,
58 int unsigned first_column_width);
66 extern
virtual protected function void
create_filters(int unsigned idx, cl_syoscb_cfg cfg);
67 extern
virtual protected function void
connect_filters(int unsigned idx, cl_syoscb_cfg cfg);
68 extern
virtual protected function void
create_filter(string queue_name,
75 int unsigned first_column_width);
78 extern
virtual function void
do_print(uvm_printer printer);
79 extern
virtual function bit do_compare(uvm_object rhs, uvm_comparer comparer);
80 extern
virtual function void do_copy(uvm_object rhs);
90 if(!uvm_config_db #(cl_syoscbs_cfg)::get(this, "", "cfg", this.cfg)) begin
91 `uvm_fatal("CFG_ERROR", "Configuration object not passed.")
94 if(this.cfg.get_scbs_name() == "") begin
95 this.
cfg.set_scbs_name(this.get_name());
99 if(this.cfg.get_print_cfg()) begin
104 this.
scbs = new[this.
cfg.get_no_scbs()];
105 this.
fts = new[this.
cfg.get_no_scbs()];
107 foreach (this.scbs[i]) begin
109 string scb_name = tmp_cfg.get_scb_name();
111 if(scb_name == "") begin
112 scb_name = $sformatf("scb[%0d]", i);
115 uvm_config_db #(cl_syoscb_cfg)::set(this, scb_name, "cfg", tmp_cfg);
117 this.
scbs[i] = cl_syoscb::type_id::create(scb_name, this);
129 let max(a,b) = (a > b) ? a : b;
130 let min_width(sl) = ((sl>pk_syoscb::MIN_FIRST_COLUMN_WIDTH)? sl : pk_syoscb::MIN_FIRST_COLUMN_WIDTH);
134 if(!this.cfg.get_disable_report()) begin
135 int unsigned offset = 2;
136 int unsigned first_column_width;
140 first_column_width = min_width(max(this.cfg.get_max_length_scb_name(),
141 max(pk_syoscb::GLOBAL_REPORT_INDENTION+this.cfg.get_max_length_queue_name(),
142 (2*pk_syoscb::GLOBAL_REPORT_INDENTION)+this.cfg.get_max_length_producer())));
146 stats_str = { stats_str, this.
create_report(offset, first_column_width) };
152 `uvm_info(
"QUEUE", $sformatf(
"[%s]: Statistics summary:%s", this.cfg.
get_scbs_name(), stats_str), UVM_NONE)
157 string failed_checks;
159 failed_checks = { failed_checks, this.get_scb_failed_checks() };
161 if(failed_checks !=
"") begin
162 `uvm_error(
"SCB_ERROR", $sformatf(
"[%s]: scb errors:\n%s", this.cfg.
get_scbs_name(), failed_checks))
165 endfunction: report_phase
176 if(idx >= this.scbs.size()) begin
177 `uvm_fatal("SCB_ERROR",
178 $sformatf("No scb existing at index %0d. Allowed index range betwen 0 and %0d",
179 idx, this.scbs.size()-1))
183 return this.scbs[idx];
195 string producer_name,
197 if(idx < this.fts.size()) begin
198 if(this.fts[idx].exists(queue_name)) begin
199 if(this.fts[idx][queue_name].exists(producer_name)) begin
200 return this.fts[idx][queue_name][producer_name];
202 `uvm_info("BAD_ARG", $sformatf("Producer name %0s was not valid for idx=%0d, queue_name=%0s", producer_name, idx, queue_name), UVM_DEBUG)
206 `uvm_info("BAD_ARG", $sformatf("Queue name %0s was not valid for idx=%0d", queue_name, idx), UVM_DEBUG)
210 `uvm_info("BAD_ARG", $sformatf("Index %0d was invalid, must be in range 0 to %0d", 0, this.fts.size()-1), UVM_DEBUG)
213 endfunction: get_filter_trfm_base
217 this.flush_queues_by_index();
218 endfunction: flush_queues_all
225 function
void cl_syoscbs_base::flush_queues_by_index(
int unsigned idxs[] = {},
string queue_names[] = {});
226 if(idxs.size() == 0) begin
227 if(queue_names.size() == 0) begin
228 foreach (this.scbs[i]) begin
232 foreach (this.scbs[i]) begin
233 foreach (queue_names[j]) begin
239 if(queue_names.size() == 0) begin
240 foreach (idxs[i]) begin
244 foreach (idxs[i]) begin
245 foreach (queue_names[j]) begin
251 endfunction: flush_queues_by_index
260 if(scb_names.size() == 0) begin
261 this.flush_queues_by_index({}, queue_names);
265 idxs =
new[scb_names.size()];
267 foreach (scb_names[i]) begin
273 if(an_index >= 0) begin
278 `uvm_fatal(
"SCB_ERROR", $sformatf(
"No scb with name '%0s' found.", scb_names[i]))
282 this.flush_queues_by_index(idxs, queue_names);
284 endfunction: flush_queues_by_name
289 this.compare_control_by_index({}, cc);
290 endfunction: compare_control_all
297 if(idxs.size() == 0) begin
298 foreach (this.scbs[i]) begin
302 foreach (idxs[i]) begin
306 endfunction: compare_control_by_index
313 if(scb_names.size() == 0) begin
314 this.compare_control_by_index({}, cc);
318 idxs =
new[scb_names.size()];
320 foreach (scb_names[i]) begin
326 if(an_index >= 0) begin
331 `uvm_fatal(
"SCB_ERROR", $sformatf(
"No scb name '%0s' found.", scb_names[i]))
335 this.compare_control_by_index(idxs, cc);
337 endfunction: compare_control_by_name
350 stats_str = { stats_str, this.create_scb_stats(offset, first_column_width) };
352 stats_str = { stats_str, this.create_total_stats(offset, first_column_width) };
355 endfunction: create_report
365 int unsigned total_cnt_add_item;
366 int unsigned total_cnt_flushed_item;
367 int unsigned total_queue_size;
371 foreach (this.scbs[i]) begin
377 total_stats = {
"\n",
378 $sformatf(
"%s%s | %8d | %8d | %8d | %8d |",
382 total_cnt_add_item-(total_cnt_flushed_item+total_queue_size), 383 total_cnt_flushed_item, 387 endfunction: create_total_stats 396 function string cl_syoscbs_base::create_scb_stats(int unsigned offset, int unsigned first_column_width);
399 foreach (this.scbs[i]) begin
400 scb_stats = { scb_stats, this.scbs[i].create_total_stats(offset, first_column_width) };
402 if(this.cfg.get_enable_scb_stats(i) == 1'b1) begin
403 scb_stats = { scb_stats, this.scbs[i].
create_report_contents(offset+pk_syoscb::GLOBAL_REPORT_INDENTION, first_column_width-pk_syoscb::GLOBAL_REPORT_INDENTION)};
405 if(i != this.scbs.size()-1) begin
412 endfunction: create_scb_stats
418 string failed_checks;
420 foreach(this.scbs[i]) begin
421 string a_failed_check;
425 failed_checks = { failed_checks, a_failed_check, a_failed_check.len()==0 ?
"" :
"\n" };
428 return failed_checks;
429 endfunction: get_scb_failed_checks
436 string producer_names[];
437 cfg.get_producers(producer_names);
438 foreach(producer_names[i]) begin
440 string queue_names[] = pl.list;
441 foreach(queue_names[j]) begin
442 this.create_filter(queue_names[j], producer_names[i], idx);
445 endfunction: create_filters
452 string producer_names[];
453 cfg.get_producers(producer_names);
454 foreach(producer_names[i]) begin
456 string queue_names[] = pl.list;
457 foreach(queue_names[j]) begin
458 this.connect_filter_and_subscriber(queue_names[j], producer_names[i], idx);
461 endfunction: connect_filters
469 string producer_name,
471 `uvm_fatal(
"IMPL_ERROR",
"create_filter MUST be implemented in a child class")
472 endfunction: create_filter
480 string producer_name,
482 `uvm_fatal("IMPL_ERROR", "connect_filter_and_subscriber() MUST be implemented in a child class")
484 endfunction: connect_filter_and_subscriber
491 if(this.scbs.size() != 0) begin
492 printer.print_generic(.name("scbs"),
494 .size(this.scbs.size()),
497 foreach(this.scbs[i]) begin
498 printer.print_object(.name($sformatf("scbs[%0d]", i)),
504 if(this.fts.size() !=0) begin
505 printer.print_generic(.name("fts"),
507 .size(this.fts.size()),
510 foreach(this.fts[i,q,p]) begin
511 printer.print_object(.name($sformatf("fts[%0d][%0s][%0d]", i, q, p)), .value(fts[i][q][p]));
515 super.do_print(printer);
516 endfunction: do_print
520 function bit
cl_syoscbs_base::do_compare(uvm_object rhs, uvm_comparer comparer);
522 bit compare_result = super.do_compare(rhs, comparer);
524 if(!$cast(rhs_cast, rhs))begin
525 `uvm_fatal("do_compare",
526 $sformatf("The given
object argument is not %0p type", rhs_cast.get_type()))
531 if(rhs_cast.scbs.size() != this.scbs.size()) begin
535 foreach(this.scbs[i]) begin
536 compare_result &= comparer.compare_object($sformatf("%0s", this.scbs[i].get_name()),
543 if(rhs_cast.fts.size() != this.fts.size()) begin
547 foreach(rhs_cast.fts[i,j,k]) begin
548 compare_result &= comparer.compare_object($sformatf("%0s", this.fts[i][j][k].get_name()),
550 rhs_cast.fts[i][j][k]);
554 return compare_result;
555 endfunction: do_compare
562 if(!$cast(rhs_cast, rhs))begin
563 `uvm_fatal("do_copy",
564 $sformatf("The given
object argument is not %0p type", rhs_cast.get_type()))
570 this.scbs = new[rhs_cast.scbs.size()];
572 foreach(rhs_cast.scbs[i]) begin
576 if(!$cast(l_scb, rhs_cast.scbs[i].clone())) begin
577 `uvm_fatal("do_copy",
578 $sformatf("Clone of scb: '%0s' failed!", rhs_cast.scbs[i].get_name()))
581 this.scbs[i] = l_scb;
587 this.fts = new[rhs_cast.fts.size()];
589 foreach(rhs_cast.fts[i,q,p]) begin
590 uvm_component filter_clone;
591 if(!$cast(filter_clone, rhs_cast.fts[i][q][p].clone())) begin
592 `uvm_fatal("DO_COPY", $sformatf("Cloning filter transform %0s failed", rhs_cast.fts[i][q][p].get_name()))
594 this.fts[i][q][p] = filter_clone;
static string scb_separator_str(int unsigned pre_length)
Creates a new separator string for scoreboard stat tables.
virtual void compare_control_by_index(int unsigned idxs[]={}, bit cc)
Scoreboard Wrapper API: Disable or enable the compare in scoreboards with given indexes.
uvm_component fts[][string][string]
Array holding handles to filter transforms, used to transform inputs of one type to outputs of anothe...
virtual string get_failed_checks()
Scoreboard API: Returns a string with information on which checks the scoreboard has failed (e...
virtual int get_scb_index_by_name(string scb_name)
Configuration API: Gets the index of a scoreboard with a given name
virtual string create_total_stats(int unsigned offset, int unsigned first_column_width)
Returns a table with summed scoreboard statistics for all wrapped scoreboards.
virtual int unsigned get_total_cnt_flushed_items()
Scoreboard API: Returns the number of elements that have been flushed out of the scoreboard ...
virtual void flush_queues_all()
Scoreboard Wrapper API: Flush all queues of all scoreboards.
virtual string create_report_contents(int unsigned offset, int unsigned first_column_width)
Scoreboard API: Returns a string with all queue's statistics, to be inserted into the final report ge...
virtual void flush_queues_by_index(int unsigned idxs[]={}, string queue_names[]={})
Scoreboard Wrapper API: Flush the queues indicated by queue_names of the scoreboards with indexes idx...
Base class for a wrapper around multiple SyoSil Scoreboards.
virtual void compare_control_by_name(string scb_names[]={}, bit cc)
Scoreboard Wrapper API: Disable or enable the compare in scoreboards with given names.
virtual int unsigned get_total_queue_size()
Scoreboard API: Returns the number of elements that the scoreboard currently contains ...
Top level class implementing the root of the SyoSil UVM scoreboard.
Configuration object for the cl_syoscbs_base scoreboard wrapper.
virtual int unsigned get_total_cnt_add_items()
Scoreboard API: Returns the number of elements that have been inserted into the scoreboard ...
cl_syoscb scbs[]
Array holding handles to all scoreboards.
virtual string get_scbs_name()
Configuration API: Returns the name of this scoreboard wrapper
virtual string get_scb_failed_checks()
Gets information on whether any of the wrapped scoreboards failed to pass error checks.
virtual cl_syoscbs_cfg get_cfg()
Gets the configuration object associated with this scoreboard wrapper.
virtual void do_print(uvm_printer printer)
Implementation of UVM do_print-hmethod Prints information of all wrapped scoreboards, as well as all filter transforms.
static string pad_str(string str, int unsigned max_length, string expand=" ", bit side=0b0)
Pads the input string with another string until it reaches a given length.
virtual void connect_filters(int unsigned idx, cl_syoscb_cfg cfg)
Connects all filter transforms with their respective subscribers in the scoreboard.
cl_syoscbs_cfg cfg
Handle to scoreboard wrapper configuration object.
virtual void flush_queues_by_name(string scb_names[]={}, string queue_names[]={})
Scoreboard Wrapper API: Flush the queues indicated by queue_names of the scoreboards with names scb_n...
virtual void create_filters(int unsigned idx, cl_syoscb_cfg cfg)
Create all filter transforms for the given scoreboard.
Utility class for capturing the queue names associated with a producer.
virtual void compare_control(bit cc)
Scoreboard API: Toggles the scoreboard's comparison control.
virtual void build_phase(uvm_phase phase)
UVM build phase.
virtual string create_scb_stats(int unsigned offset, int unsigned first_column_width)
Returns a string containing the tables with statistics of the different scoreboards.
virtual void connect_phase(uvm_phase phase)
UVM connect phase. syoscbs_base only calls super.connect_phase.
virtual void create_filter(string queue_name, string producer_name, int unsigned idx)
Creates a filter for given scoreboard/queue name/producer combination.
virtual void compare_control_all(bit cc)
Scoreboard Wrapper API: Disable or enable the compare in all scoreboards.
virtual string create_report(int unsigned offset, int unsigned first_column_width)
Scoreboard Wrapper API: Creates a summary report once simulation has finished.
virtual cl_syoscb get_scb(int unsigned idx)
Scoreboard Wrapper API: Get a handle to a scoreboard inside this wrapper
virtual void connect_filter_and_subscriber(string queue_name, string producer_name, int unsigned idx)
Connects a filter's output to a scoreboard's subscriber.
Configuration class for the SyoSil UVM scoreboard.
virtual uvm_component get_filter_trfm_base(string queue_name, string producer_name, int unsigned idx)
Scoreboard Wrapper API: Gets a handle to a filter transform as a uvm_component.
virtual void flush_queues(string queue_name="")
Scoreboard API: Flushes the contents of either all queues or a specific queue.
virtual void report_phase(uvm_phase phase)
UVM report_phase.
static string scb_header_str(string hn, int unsigned pre_length, bit side, string col_names[]=(" Inserts ", " Matches ", " Flushed ", " Orphans "))
Creates a new header string for a scoreboard stat table.