00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 `define VMM_DOSFILE_CHECK If you get a syntax error on this line, \
00023 the file is corrupt. Make sure you unpack the VMM distribution \
00024 file with gunzip then tar, not a Windows tool
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 `ifdef VCS
00038 `define VCS2006_06
00039 `endif
00040
00041
00042
00043
00044
00045
00046 `ifndef VMM_DPI_
00047 `define VMM_DPI_
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 `ifndef vmm_sformatf
00059 `define vmm_sformatf $psprintf
00060 `endif
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 `ifdef VCS
00076 `define vmm_str_match(str, regex) str.match(regex)
00077 `define vmm_str_prematch(str) str.prematch()
00078 `define vmm_str_postmatch(str) str.postmatch()
00079 `define vmm_str_backref(str, n) str.backref(n)
00080
00081 `else
00082
00083 `ifdef VMM_NO_STR_DPI
00084
00085 `define vmm_str_match(str, regex) 0
00086 `define vmm_str_prematch(str) ""
00087 `define vmm_str_postmatch(str) ""
00088 `define vmm_str_backref(str, n) ""
00089
00090 `else
00091
00092 import "DPI-C" function int vmm_str_match(input string str1, input string regex);
00093 import "DPI-C" function string vmm_str_prematch();
00094 import "DPI-C" function string vmm_str_postmatch();
00095 import "DPI-C" function string vmm_str_backref(int n);
00096
00097 `define vmm_str_match(str, regex) vmm_str_match(str, regex)
00098 `define vmm_str_prematch(str) vmm_str_prematch()
00099 `define vmm_str_postmatch(str) vmm_str_postmatch()
00100 `define vmm_str_backref(str, n) vmm_str_backref(n+1)
00101
00102 `endif
00103
00104 `endif
00105
00106
00107 `endif
00108
00109
00110
00111
00112
00113
00114
00115
00116 `ifndef VMM_MACRO_DEFINED
00117 `define VMM_MACRO_DEFINED
00118
00119
00120
00121
00122
00123
00124
00125 `ifdef VMM_PRE_INCLUDE
00126 `include `VMM_PRE_INCLUDE
00127 `endif
00128
00129
00130 `ifndef VMM_DATA
00131 `define VMM_DATA vmm_data
00132 `endif
00133 `ifndef VMM_DATA_NEW_ARGS
00134 `define VMM_DATA_NEW_ARGS
00135 `define VMM_DATA_NEW_EXTERN_ARGS
00136 `define VMM_DATA_NEW_CALL
00137 `endif
00138 `ifndef VMM_DATA_BASE_NEW_ARGS
00139 `define VMM_DATA_BASE_NEW_ARGS
00140 `define VMM_DATA_BASE_NEW_EXTERN_ARGS
00141 `endif
00142 `ifdef VMM_DATA_BASE
00143 `ifndef VMM_DATA_BASE_NEW_CALL
00144 `define VMM_DATA_BASE_NEW_CALL
00145 `endif
00146 `endif
00147 `ifndef VMM_DATA_BASE_METHODS
00148 `define VMM_DATA_BASE_METHODS
00149 `endif
00150
00151 `ifndef VMM_CHANNEL
00152 `define VMM_CHANNEL vmm_channel
00153 `endif
00154 `ifdef VMM_CHANNEL_BASE
00155 `ifndef VMM_CHANNEL_BASE_NEW_CALL
00156 `define VMM_CHANNEL_BASE_NEW_CALL
00157 `endif
00158 `endif
00159 `ifndef VMM_CHANNEL_BASE_METHODS
00160 `define VMM_CHANNEL_BASE_METHODS
00161 `endif
00162
00163 `ifndef VMM_CONSENSUS
00164 `define VMM_CONSENSUS vmm_consensus
00165 `endif
00166 `ifdef VMM_CONSENSUS_BASE
00167 `ifndef VMM_CONSENSUS_BASE_NEW_CALL
00168 `define VMM_CONSENSUS_BASE_NEW_CALL
00169 `endif
00170 `endif
00171 `ifndef VMM_CONSENSUS_BASE_METHODS
00172 `define VMM_CONSENSUS_BASE_METHODS
00173 `endif
00174
00175 `ifndef VMM_LOG
00176 `define VMM_LOG vmm_log
00177 `endif
00178 `ifdef VMM_LOG_BASE
00179 `ifndef VMM_LOG_BASE_NEW_CALL
00180 `define VMM_LOG_BASE_NEW_CALL
00181 `endif
00182 `endif
00183 `ifndef VMM_LOG_BASE_METHODS
00184 `define VMM_LOG_BASE_METHODS
00185 `endif
00186
00187 `ifndef VMM_NOTIFY
00188 `define VMM_NOTIFY vmm_notify
00189 `endif
00190 `ifdef VMM_NOTIFY_BASE
00191 `ifndef VMM_NOTIFY_BASE_NEW_CALL
00192 `define VMM_NOTIFY_BASE_NEW_CALL
00193 `endif
00194 `endif
00195 `ifndef VMM_NOTIFY_BASE_METHODS
00196 `define VMM_NOTIFY_BASE_METHODS
00197 `endif
00198
00199 `ifndef VMM_XACTOR
00200 `define VMM_XACTOR vmm_xactor
00201 `endif
00202 `ifndef VMM_XACTOR_NEW_ARGS
00203 `define VMM_XACTOR_NEW_ARGS
00204 `define VMM_XACTOR_NEW_EXTERN_ARGS
00205 `define VMM_XACTOR_NEW_CALL
00206 `endif
00207 `ifndef VMM_XACTOR_BASE_NEW_ARGS
00208 `define VMM_XACTOR_BASE_NEW_ARGS
00209 `define VMM_XACTOR_BASE_NEW_EXTERN_ARGS
00210 `endif
00211 `ifdef VMM_XACTOR_BASE
00212 `ifndef VMM_XACTOR_BASE_NEW_CALL
00213 `define VMM_XACTOR_BASE_NEW_CALL
00214 `endif
00215 `endif
00216 `ifndef VMM_XACTOR_BASE_METHODS
00217 `define VMM_XACTOR_BASE_METHODS
00218 `endif
00219
00220 `ifndef VMM_SUBENV
00221 `define VMM_SUBENV vmm_subenv
00222 `endif
00223 `ifndef VMM_SUBENV_NEW_ARGS
00224 `define VMM_SUBENV_NEW_ARGS
00225 `define VMM_SUBENV_NEW_EXTERN_ARGS
00226 `define VMM_SUBENV_NEW_CALL
00227 `endif
00228 `ifndef VMM_SUBENV_BASE_NEW_ARGS
00229 `define VMM_SUBENV_BASE_NEW_ARGS
00230 `define VMM_SUBENV_BASE_NEW_EXTERN_ARGS
00231 `endif
00232 `ifdef VMM_SUBENV_BASE
00233 `ifndef VMM_SUBENV_BASE_NEW_CALL
00234 `define VMM_SUBENV_BASE_NEW_CALL
00235 `endif
00236 `endif
00237 `ifndef VMM_SUBENV_BASE_METHODS
00238 `define VMM_SUBENV_BASE_METHODS
00239 `endif
00240
00241 `ifndef VMM_ENV
00242 `define VMM_ENV vmm_env
00243 `endif
00244 `ifndef VMM_ENV_NEW_ARGS
00245 `define VMM_ENV_NEW_ARGS
00246 `define VMM_ENV_NEW_EXTERN_ARGS
00247 `define VMM_ENV_NEW_CALL
00248 `endif
00249 `ifndef VMM_ENV_BASE_NEW_ARGS
00250 `define VMM_ENV_BASE_NEW_ARGS
00251 `define VMM_ENV_BASE_NEW_EXTERN_ARGS
00252 `endif
00253 `ifdef VMM_ENV_BASE
00254 `ifndef VMM_ENV_BASE_NEW_CALL
00255 `define VMM_ENV_BASE_NEW_CALL
00256 `endif
00257 `endif
00258 `ifndef VMM_ENV_BASE_METHODS
00259 `define VMM_ENV_BASE_METHODS
00260 `endif
00261
00262
00263
00264
00265
00266
00267
00268 `define vmm_warning(log, msg) \
00269 do \
00270 if (log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV)) begin \
00271 void'(log.text(msg)); \
00272 log.end_msg(); \
00273 end \
00274 while(0)
00275
00276 `define vmm_error(log, msg) \
00277 do \
00278 if (log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV)) begin \
00279 void'(log.text(msg)); \
00280 log.end_msg(); \
00281 end \
00282 while (0)
00283
00284 `define vmm_fatal(log, msg) \
00285 do \
00286 if (log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin \
00287 void'(log.text(msg)); \
00288 log.end_msg(); \
00289 end \
00290 while (0)
00291
00292
00293
00294
00295
00296
00297 `ifdef VMM_NULL_LOG_MACROS
00298
00299 `define vmm_trace(log, msg)
00300 `define vmm_debug(log, msg)
00301 `define vmm_verbose(log, msg)
00302 `define vmm_note(log, msg)
00303 `define vmm_report(log, msg)
00304 `define vmm_command(log, msg)
00305 `define vmm_protocol(log, msg)
00306 `define vmm_transaction(log, msg)
00307 `define vmm_cycle(log, msg)
00308 `define vmm_user(n, log, msg)
00309
00310 `else
00311
00312 `define vmm_trace(log, msg) \
00313 do \
00314 if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::TRACE_SEV)) begin \
00315 void'(log.text(msg)); \
00316 log.end_msg(); \
00317 end \
00318 while (0)
00319
00320 `define vmm_debug(log, msg) \
00321 do \
00322 if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin \
00323 void'(log.text(msg)); \
00324 log.end_msg(); \
00325 end \
00326 while (0)
00327
00328 `define vmm_verbose(log, msg) \
00329 do \
00330 if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::VERBOSE_SEV)) begin \
00331 void'(log.text(msg)); \
00332 log.end_msg(); \
00333 end \
00334 while (0)
00335
00336 `define vmm_note(log, msg) \
00337 do \
00338 if (log.start_msg(vmm_log::NOTE_TYP)) begin \
00339 void'(log.text(msg)); \
00340 log.end_msg(); \
00341 end \
00342 while (0)
00343
00344 `define vmm_report(log, msg) \
00345 do \
00346 if (log.start_msg(vmm_log::REPORT_TYP)) begin \
00347 void'(log.text(msg)); \
00348 log.end_msg(); \
00349 end \
00350 while (0)
00351
00352 `define vmm_command(log, msg) \
00353 do \
00354 if (log.start_msg(vmm_log::COMMAND_TYP)) begin \
00355 void'(log.text(msg)); \
00356 log.end_msg(); \
00357 end \
00358 while (0)
00359
00360 `define vmm_protocol(log, msg) \
00361 do \
00362 if (log.start_msg(vmm_log::PROTOCOL_TYP)) begin \
00363 void'(log.text(msg)); \
00364 log.end_msg(); \
00365 end \
00366 while (0)
00367
00368 `define vmm_transaction(log, msg) \
00369 do \
00370 if (log.start_msg(vmm_log::TRANSACTION_TYP)) begin \
00371 void'(log.text(msg)); \
00372 log.end_msg(); \
00373 end \
00374 while (0)
00375
00376 `define vmm_cycle(log, msg) \
00377 do \
00378 if (log.start_msg(vmm_log::CYCLE_TYP)) begin \
00379 void'(log.text(msg)); \
00380 log.end_msg(); \
00381 end \
00382 while (0)
00383
00384 `define vmm_user(n, log, msg) \
00385 do \
00386 if (log.start_msg(vmm_log::USER_TYP_``n)) begin \
00387 void'(log.text(msg)); \
00388 log.end_msg(); \
00389 end \
00390 while (0)
00391
00392 `endif
00393
00394
00395
00396
00397
00398
00399
00400 `define vmm_callback(facade, call) \
00401 \
00402 do foreach (this.callbacks[vmm_i]) begin \
00403 facade cb; \
00404 if (!$cast(cb, this.callbacks[vmm_i])) continue; \
00405 \
00406 cb.call; \
00407 end while (0)
00408
00409
00410
00411
00412
00413
00414
00415 `include "std_lib/vmm_data_macros.sv"
00416
00417
00418 `ifdef VMM_PARAM_CHANNEL
00419
00420 `define vmm_channel(T) typedef vmm_channel_typed#(T) T``_channel;
00421
00422 `else
00423
00424 `define vmm_channel_(T) T``_channel
00425
00426 `define vmm_channel(T) \
00427 class `vmm_channel_(T) extends vmm_channel; \
00428 \
00429 function new(string name, \
00430 string inst, \
00431 int full = 1, \
00432 int empty = 0, \
00433 bit fill_as_bytes = 0); \
00434 super.new(name, inst, full, empty, fill_as_bytes); \
00435 endfunction: new \
00436 \
00437 function T unput(int offset = -1); \
00438 $cast(unput, super.unput(offset)); \
00439 endfunction: unput \
00440 \
00441 task get(output T obj, input int offset = 0); \
00442 vmm_data o; \
00443 super.get(o, offset); \
00444 $cast(obj, o); \
00445 endtask: get \
00446 \
00447 task peek(output T obj, input int offset = 0); \
00448 vmm_data o; \
00449 super.peek(o, offset); \
00450 $cast(obj, o); \
00451 endtask: peek \
00452 \
00453 task activate(output T obj, input int offset = 0); \
00454 vmm_data o; \
00455 super.activate(o, offset); \
00456 $cast(obj, o); \
00457 endtask: activate \
00458 \
00459 function T active_slot(); \
00460 $cast(active_slot, super.active_slot()); \
00461 endfunction: active_slot \
00462 \
00463 function T start(); \
00464 $cast(start, super.start()); \
00465 endfunction: start \
00466 \
00467 function T complete(vmm_data status = null); \
00468 $cast(complete, super.complete(status)); \
00469 endfunction: complete \
00470 \
00471 function T remove(); \
00472 $cast(remove, super.remove()); \
00473 endfunction: remove \
00474 \
00475 task tee(output T obj); \
00476 vmm_data o; \
00477 super.tee(o); \
00478 $cast(obj, o); \
00479 endtask: tee \
00480 \
00481 function T for_each(bit reset = 0); \
00482 $cast(for_each, super.for_each(reset)); \
00483 endfunction: for_each \
00484 endclass
00485
00486 `endif
00487
00488 `include "std_lib/vmm_atomic_gen.sv"
00489 `include "std_lib/vmm_scenario_gen.sv"
00490
00491
00492
00493
00494
00495 `endif
00496
00497
00498
00499
00500
00501 `ifndef VMM__SV
00502 `define VMM__SV
00503
00504
00505 `ifdef VMM_IN_PACKAGE
00506
00507
00508 `ifdef VCS
00509 (* _vcs_vmm_pkg = 1 *)
00510 `endif
00511 package vmm_std_lib;
00512 `endif
00513
00514
00515
00516
00517
00518
00519
00520 `ifdef VCS
00521 (* _vcs_vmm_class = 1 *)
00522 `endif
00523 class vmm_version;
00524 extern function int major();
00525 extern function int minor();
00526 extern function int patch();
00527 extern function string vendor();
00528
00529 extern function void display(string prefix = "");
00530 extern function string psdisplay(string prefix = "");
00531 extern function void cfdisplay(string prefix = "");
00532 endclass: vmm_version
00533
00534
00535
00536
00537
00538
00539
00540 typedef class vmm_log;
00541 typedef class vmm_data;
00542 typedef class vmm_xactor;
00543 typedef class vmm_notify;
00544
00545
00546 typedef class `VMM_DATA;
00547 `ifdef VMM_DATA_BASE
00548 typedef class `VMM_DATA_BASE;
00549 `endif
00550 `ifdef VMM_CHANNEL_BASE
00551 typedef class `VMM_CHANNEL_BASE;
00552 `endif
00553 `ifdef VMM_CONSENSUS_BASE
00554 typedef class `VMM_CONSENSUS_BASE;
00555 `endif
00556 `ifdef VMM_LOG_BASE
00557 typedef class `VMM_LOG_BASE;
00558 `endif
00559 `ifdef VMM_NOTIFY_BASE
00560 typedef class `VMM_NOTIFY_BASE;
00561 `endif
00562 typedef class `VMM_XACTOR;
00563 `ifdef VMM_XACTOR_BASE
00564 typedef class `VMM_XACTOR_BASE;
00565 `endif
00566 typedef class `VMM_SUBENV;
00567 `ifdef VMM_SUBENV_BASE
00568 typedef class `VMM_SUBENV_BASE;
00569 `endif
00570 typedef class `VMM_ENV;
00571 `ifdef VMM_ENV_BASE
00572 typedef class `VMM_ENV_BASE;
00573 `endif
00574
00575
00576 `ifdef VMM_POST_INCLUDE
00577 `include `VMM_POST_INCLUDE
00578 `endif
00579
00580
00581
00582
00583
00584
00585 `ifdef VCS
00586 (* _vcs_vmm_class = 1 *)
00587 `endif
00588 class vmm_log_format;
00589 extern virtual function string format_msg(string name,
00590 string inst,
00591 string msg_typ,
00592 string severity,
00593 ref string lines[$]);
00594
00595 extern virtual function string continue_msg(string name,
00596 string inst,
00597 string msg_typ,
00598 string severity,
00599 ref string lines[$]);
00600
00601 extern virtual function string abort_on_error(int count,
00602 int limit);
00603
00604 extern virtual function string pass_or_fail(bit pass,
00605 string name,
00606 string inst,
00607 int fatals,
00608 int errors,
00609 int warnings,
00610 int dem_errs,
00611 int dem_warns);
00612 endclass: vmm_log_format
00613
00614
00615 `ifdef VCS
00616 (* vmm_callback_class, _vcs_vmm_class = 1 *)
00617 `endif
00618 class vmm_log_callbacks;
00619 virtual function void pre_abort(vmm_log log);
00620 endfunction
00621
00622 virtual function void pre_stop(vmm_log log);
00623 endfunction
00624
00625 virtual function void pre_debug(vmm_log log);
00626 endfunction
00627 endclass: vmm_log_callbacks
00628
00629
00630 typedef class vmm_log_below_iter;
00631 typedef class vmm_log_msg;
00632 typedef class vmm_log_modifier;
00633 typedef class vmm_log_watchpoint;
00634
00635 `ifdef VCS
00636 (* _vcs_vmm_class = 1 *)
00637 `endif
00638 class vmm_log
00639 `ifdef VMM_LOG_BASE
00640 extends `VMM_LOG_BASE
00641 `endif
00642 ;
00643
00644
00645
00646
00647 typedef enum int {DEFAULT
00648 = -1
00649 , UNCHANGED
00650 = -2
00651 } symbols_e;
00652
00653
00654
00655
00656 typedef enum int {FAILURE_TYP = 'h0001,
00657 NOTE_TYP = 'h0002,
00658 DEBUG_TYP = 'h0004,
00659 REPORT_TYP = 'h0008,
00660 NOTIFY_TYP = 'h0010,
00661 TIMING_TYP = 'h0020,
00662 XHANDLING_TYP = 'h0040,
00663 PROTOCOL_TYP = 'h0080,
00664 TRANSACTION_TYP = 'h0100,
00665 COMMAND_TYP = 'h0200,
00666 CYCLE_TYP = 'h0400,
00667 USER_TYP_0 = 'h0800,
00668 USER_TYP_1 = 'h1000,
00669 USER_TYP_2 = 'h2000,
00670 INTERNAL_TYP = 'h4000,
00671 DEFAULT_TYP = -1,
00672 ALL_TYPS = 'hFFFF
00673 } types_e;
00674
00675
00676
00677
00678 typedef enum int {FATAL_SEV = 'h0001,
00679 ERROR_SEV = 'h0002,
00680 WARNING_SEV = 'h0004,
00681 NORMAL_SEV = 'h0008,
00682 TRACE_SEV = 'h0010,
00683 DEBUG_SEV = 'h0020,
00684 VERBOSE_SEV = 'h0040,
00685 HIDDEN_SEV = 'h0080,
00686 IGNORE_SEV = 'h0100,
00687 DEFAULT_SEV = -1,
00688 ALL_SEVS = 'hFFFF
00689 } severities_e;
00690
00691
00692
00693
00694 typedef enum int {CONTINUE = 'h0001,
00695 COUNT_ERROR = 'h0002,
00696 DEBUGGER = 'h0004,
00697 DUMP_STACK = 'h0008,
00698 STOP_PROMPT = 'h0010,
00699 ABORT_SIM = 'h0020,
00700 IGNORE = 'h0040,
00701 DEFAULT_HANDLING = -1
00702 } handling_e;
00703
00704 //
00705 // Pre-defined STDOUT in case the simulator does not already define it
00706 //
00707 typedef enum int {STDOUT = 32'h8000_0001} stdout_e;
00708
00709
00710
00711
00712 static local int error_count = 0;
00713 static local int error_limit = 10;
00714 static local string msg_format[$];
00715 static local string prefix;
00716
00717
00718
00719
00720 static local int dflt_lvl = NORMAL_SEV;
00721 static local int force_lvl = DEFAULT_SEV;
00722 static local bit plus_debug;
00723
00724 local string name;
00725 local string inst;
00726
00727 local int n_msg[*];
00728 local int n_demoted[*];
00729
00730
00731
00732
00733 local vmm_log_msg msg;
00734 local string msg_txt[$];
00735
00736 static local int type_list[$];
00737 static local string type_images[*];
00738
00739 static local int sev_list[$];
00740 static local string sev_images[*];
00741
00742 static local vmm_log_modifier modifier_cache[*];
00743 local int modifier_ids[$];
00744 local int has_text_modifiers;
00745
00746 static local vmm_log_watchpoint watchpoint_cache[*];
00747 local int watchpoint_ids[$];
00748
00749 local int enabled_typs;
00750 local int log_lvl;
00751
00752
00753
00754
00755 static local vmm_log_format fmt = new;
00756 static local int in_callbacks = 0;
00757 static local vmm_log_callbacks callbacks[$];
00758
00759
00760
00761
00762 local int fp[$];
00763
00764
00765
00766
00767 local int is_self;
00768 local bit is_all;
00769 static local vmm_log known[$];
00770
00771 vmm_log below[$];
00772 static local int recurse_id = 0;
00773 local int visited = 0;
00774
00775 static local string pattern[2];
00776 static local bit is_pattern[2];
00777 static local int known_idx = 0;
00778 static local int recurse;
00779 static local vmm_log_below_iter recurse_stack[$];
00780
00781 `ifdef VMM_LOG_BASE_METHODS
00782 `VMM_LOG_BASE_METHODS
00783 `endif
00784
00785 extern function new(string name,
00786 string inst,
00787 vmm_log under = null);
00788
00789 extern virtual function void is_above(vmm_log log);
00790 extern virtual function vmm_log copy(vmm_log to = null);
00791
00792 extern virtual function void set_name(string name);
00793 extern virtual function string get_name();
00794 extern virtual function void set_instance(string inst);
00795 extern virtual function string get_instance();
00796
00797 extern function void reset(string name = "/./",
00798 string inst = "/./",
00799 bit recurse = 0);
00800 extern function vmm_log for_each();
00801 extern virtual function void list(string name = "/./",
00802 string inst = "/./",
00803 bit recurse = 0);
00804
00805 extern virtual function void display(string prefix = "");
00806 extern virtual function string psdisplay(string prefix = "");
00807
00808 extern virtual function void kill();
00809
00810
00811
00812
00813 extern virtual function vmm_log_format set_format(vmm_log_format fmt);
00814 extern virtual function string set_typ_image(int typ, string image);
00815 extern virtual function string set_sev_image(int severity, string image);
00816
00817 extern function string typ_image(int typ);
00818 extern function string sev_image(int severity);
00819 extern function string handling_image(int handling);
00820 extern local function int default_handling(int severity);
00821
00822 extern virtual function void report(string name = "/./",
00823 string inst = "/./",
00824 bit recurse = 0);
00825
00826
00827
00828
00829
00830 extern virtual function bit start_msg(int typ,
00831 int severity = DEFAULT_SEV);
00832
00833 extern virtual function bit text(string msg = "");
00834 extern virtual function void end_msg();
00835 extern local function void flush_msg();
00836
00837
00838
00839
00840 extern virtual function void enable_types(int typs,
00841 string name = "",
00842 string inst = "",
00843 bit recursive = 0);
00844 extern virtual function void disable_types(int typs,
00845 string name = "",
00846 string inst = "",
00847 bit recursive = 0);
00848 extern virtual function int modify(string name = "",
00849 string inst = "",
00850 bit recursive = 0,
00851 int typ = ALL_TYPS,
00852 int severity = ALL_SEVS,
00853 string text = "",
00854 int new_typ = UNCHANGED,
00855 int new_severity = UNCHANGED,
00856 int handling = UNCHANGED);
00857 extern virtual function void unmodify(int modification_id = -1,
00858 string name = "",
00859 string inst = "",
00860 bit recursive = 0);
00861
00862 extern local function void promote();
00863 extern local function void filter();
00864 extern local function void notify();
00865
00866 extern virtual function void set_verbosity(int severity,
00867 string name = "",
00868 string inst = "",
00869 bit recursive = 0);
00870 extern function int get_verbosity();
00871
00872
00873
00874
00875 extern virtual function void log_start(int file,
00876 string name = "",
00877 string inst = "",
00878 bit recurse = 0);
00879 extern virtual function void log_stop(int file,
00880 string name = "",
00881 string inst = "",
00882 bit recurse = 0);
00883
00884
00885
00886
00887
00888 extern virtual function void stop_after_n_errors(int n);
00889 extern virtual function int get_message_count(int severity = ALL_SEVS,
00890 string name = "",
00891 string inst = "",
00892 bit recurse = 0);
00893
00894
00895
00896
00897 extern virtual task wait_for_msg(string name = "",
00898 string inst = "",
00899 bit recurse = 0,
00900 int typs = ALL_TYPS,
00901 int severity = ALL_SEVS,
00902 string text = "",
00903 logic issued = 1'bx,
00904 ref vmm_log_msg msg);
00905
00906 extern virtual function int create_watchpoint(int typs = ALL_TYPS,
00907 int severity = ALL_SEVS,
00908 string text = "",
00909 logic issued = 1'bx);
00910 extern virtual function void add_watchpoint(int watchpoint_id,
00911 string name = "",
00912 string inst = "",
00913 bit recurse = 0);
00914 extern virtual function void remove_watchpoint(int watchpoint_id = -1,
00915 string name = "",
00916 string inst = "",
00917 bit recurse = 0);
00918 extern virtual task wait_for_watchpoint(int watchpoint_id,
00919 ref vmm_log_msg msg);
00920
00921
00922
00923
00924 extern virtual function void prepend_callback(vmm_log_callbacks cb);
00925 extern virtual function void append_callback(vmm_log_callbacks cb);
00926 extern virtual function void unregister_callback(vmm_log_callbacks cb);
00927
00928
00929
00930
00931 endclass: vmm_log
00932
00933
00934 `ifdef VMM_SB_DS_IN_STDLIB
00935 `include "sb/vmm_sb.sv"
00936 (* _vcs_vmm_class = 1 *)
00937 class vmm_sb_ds_registration;
00938 vmm_sb_ds sb;
00939 bit is_in;
00940 bit is_out;
00941 vmm_sb_ds::ordering_e order;
00942 endclass
00943 `endif
00944
00945
00946
00947
00948
00949
00950 `ifdef VCS
00951 (* vmm_callback_class, _vcs_vmm_class = 1 *)
00952 `endif
00953 virtual class vmm_notify_callbacks;
00954 virtual function void indicated(vmm_data status);
00955 endfunction
00956 endclass
00957
00958 `ifdef VCS
00959 (* _vcs_vmm_class = 1 *)
00960 `endif
00961 virtual class vmm_notification;
00962 virtual task indicate(ref vmm_data status);
00963 $write("FATAL: An instance of vmm_notification::indicate() was not overloaded or super.indicate() was called\n");
00964 $finish;
00965 endtask
00966 virtual task reset();
00967 $write("FATAL: An instance of vmm_notification::reset() was not overloaded or super.reset() was called\n");
00968 $finish;
00969 endtask
00970 endclass
00971
00972
00973 typedef class vmm_notification_config;
00974
00975
00976 `ifdef VCS
00977 (* _vcs_vmm_class = 1 *)
00978 `endif
00979 class vmm_notify
00980 `ifdef VMM_NOTIFY_BASE
00981 extends `VMM_NOTIFY_BASE
00982 `endif
00983 ;
00984 `VMM_LOG log;
00985
00986 typedef enum int {ONE_SHOT = 2,
00987 BLAST = 3,
00988 ON_OFF = 5
00989 } sync_e;
00990
00991 typedef enum bit {SOFT,
00992 HARD} reset_e;
00993
00994
00995 local int last_notification_id = 1000000;
00996 local vmm_notification_config configs[*];
00997
00998 extern function new(`VMM_LOG log);
00999
01000 `ifdef VMM_NOTIFY_BASE_METHODS
01001 `VMM_NOTIFY_BASE_METHODS
01002 `endif
01003
01004 extern virtual function void display(string prefix = "");
01005 extern virtual function string psdisplay(string prefix = "");
01006
01007 extern virtual function vmm_notify copy(vmm_notify to = null);
01008 extern virtual function int configure(int notification_id = -1,
01009 sync_e sync = ONE_SHOT);
01010 extern virtual function int is_configured(int notification_id);
01011
01012 extern virtual function bit is_on(int notification_id);
01013
01014 extern virtual task wait_for(int notification_id);
01015 extern virtual task wait_for_off(int notification_id);
01016
01017 extern virtual function bit is_waited_for(int notification_id);
01018 extern virtual function void terminated(int notification_id);
01019
01020 extern virtual function vmm_data status(int notification_id);
01021 extern virtual function time timestamp(int notification_id);
01022 extern virtual function void indicate(int notification_id,
01023 vmm_data status = null);
01024
01025 extern virtual function void set_notification(int notification_id,
01026 vmm_notification ntfy = null);
01027 extern virtual function vmm_notification get_notification(int notification_id);
01028 extern virtual function void reset(int notification_id = -1,
01029 reset_e rst_typ = SOFT);
01030
01031 extern function void append_callback(int notification_id,
01032 vmm_notify_callbacks cbs);
01033 extern function void unregister_callback(int notification_id,
01034 vmm_notify_callbacks cbs);
01035
01036
01037
01038
01039 `ifdef VMM_SB_DS_IN_STDLIB
01040 extern function void register_vmm_sb_ds(int notification_id,
01041 vmm_sb_ds sb,
01042 vmm_sb_ds::kind_e kind,
01043 vmm_sb_ds::ordering_e order = vmm_sb_ds::IN_ORDER);
01044 extern function void unregister_vmm_sb_ds(int notification_id,
01045 vmm_sb_ds sb);
01046 `endif
01047
01048 endclass
01049
01050
01051
01052
01053
01054
01055 `ifdef VCS
01056 (* _vcs_vmm_class = 1 *)
01057 `endif
01058 class vmm_data
01059 `ifdef VMM_DATA_BASE
01060 extends `VMM_DATA_BASE
01061 `endif
01062 ;
01063
01064 local `VMM_LOG log;
01065
01066 int stream_id;
01067 int scenario_id;
01068 int data_id;
01069
01070 `VMM_NOTIFY notify;
01071 typedef enum int {EXECUTE = 999_999,
01072 STARTED = 999_998,
01073 ENDED = 999_997
01074 } notifications_e;
01075
01076 extern function new(`VMM_LOG log
01077 `VMM_DATA_BASE_NEW_ARGS);
01078
01079 `ifdef VMM_DATA_BASE_METHODS
01080 `VMM_DATA_BASE_METHODS
01081 `endif
01082
01083 extern function vmm_log set_log(`VMM_LOG log);
01084
01085 extern function void display(string prefix = "");
01086 extern virtual function string psdisplay(string prefix = "");
01087
01088 extern virtual function bit is_valid(bit silent = 1,
01089 int kind = -1);
01090 extern virtual function vmm_data allocate();
01091 extern virtual function vmm_data copy(vmm_data to = null);
01092 extern virtual protected function void copy_data(vmm_data to);
01093
01094 extern virtual function bit compare( vmm_data to,
01095 output string diff,
01096 input int kind = -1);
01097
01098 extern virtual function int unsigned byte_size(int kind = -1);
01099 extern virtual function int unsigned max_byte_size(int kind = -1);
01100 extern virtual function int unsigned byte_pack(ref logic [7:0] bytes[],
01101 input int unsigned offset = 0,
01102 input int kind = -1);
01103 extern virtual function int unsigned byte_unpack(const ref logic [7:0] bytes[],
01104 input int unsigned offset = 0,
01105 input int len = -1,
01106 input int kind = -1);
01107 extern virtual function bit load(int file);
01108 extern virtual function void save(int file);
01109
01110
01111
01112
01113 protected static string __vmm_prefix;
01114 protected static string __vmm_image;
01115 protected static vmm_data __vmm_rhs;
01116 protected static int __vmm_kind;
01117 protected static int __vmm_offset;
01118 protected static int __vmm_len;
01119 protected static bit [4095:0] __vmm_maxbits;
01120 protected static bit __vmm_status;
01121 protected static logic [7:0] __vmm_bytes[];
01122 protected static bit __vmm_done_user;
01123
01124 typedef enum {DO_PRINT ='h001,
01125 DO_COPY ='h002,
01126 DO_COMPARE ='h004,
01127 DO_PACK ='h010,
01128 DO_UNPACK ='h020,
01129 DO_ALL ='hFFF} do_what_e;
01130
01131 typedef enum {DO_NOCOPY ='h001,
01132 DO_REFCOPY ='h002,
01133 DO_DEEPCOPY ='h004,
01134 HOW_TO_COPY ='h007,
01135 DO_NOCOMPARE ='h008,
01136 DO_REFCOMPARE ='h010,
01137 DO_DEEPCOMPARE ='h020,
01138 HOW_TO_COMPARE ='h038,
01139 DO_NONE ='h009, // OR of all DO_NO*
01140 DO_REF ='h012,
01141 DO_DEEP ='h024, // OR of all DO_DEEP*
01142 _DO_DUMMY} do_how_e;
01143
01144 function void do_all( do_what_e what,
01145 ref logic [7:0] pack[],
01146 const ref logic [7:0] unpack[]);
01147 endfunction
01148
01149 extern virtual function string do_psdisplay(string prefix = "");
01150
01151 extern virtual function bit do_is_valid(bit silent = 1,
01152 int kind = -1);
01153 extern virtual function vmm_data do_allocate();
01154 extern virtual function vmm_data do_copy(vmm_data to = null);
01155
01156 extern virtual function bit do_compare( vmm_data to,
01157 output string diff,
01158 input int kind = -1);
01159
01160 extern virtual function int unsigned do_byte_size(int kind = -1);
01161 extern virtual function int unsigned do_max_byte_size(int kind = -1);
01162 extern virtual function int unsigned do_byte_pack(ref logic [7:0] bytes[],
01163 input int unsigned offset = 0,
01164 input int kind = -1);
01165 extern virtual function int unsigned do_byte_unpack(const ref logic [7:0] bytes[],
01166 input int unsigned offset = 0,
01167 input int len = -1,
01168 input int kind = -1);
01169
01170
01171 `ifdef VCS
01172 extern function int vmt_hook(vmm_xactor xactor = null,
01173 vmm_data obj = null);
01174
01175
01176 `endif
01177 endclass: vmm_data
01178
01179
01180 //---------------------------------------------------------------------
01181 // vmm_channel
01182 //
01183
01184 `ifdef VCS
01185 (* _vcs_vmm_class = 1 *)
01186 `endif
01187 class vmm_channel
01188 `ifdef VMM_CHANNEL_BASE
01189 extends `VMM_CHANNEL_BASE
01190 `endif
01191 ;
01192 `VMM_LOG log;
01193 `VMM_NOTIFY notify;
01194
01195 // Predefined notifications
01196 typedef enum int unsigned {FULL,
01197 EMPTY,
01198 PUT,
01199 GOT,
01200 PEEKED,
01201 ACTIVATED,
01202 ACT_STARTED,
01203 ACT_COMPLETED,
01204 ACT_REMOVED,
01205 LOCKED,
01206 UNLOCKED} notifications_e;
01207
01208 // Arguments for lock methods
01209 typedef enum bit [1:0] {SOURCE = 2'b01,
01210 SINK = 2'b10
01211 } endpoints_e;
01212
01213 typedef enum int unsigned {INACTIVE = 0,
01214 PENDING = 1,
01215 STARTED = 2,
01216 COMPLETED = 3
01217 } active_status_e;
01218
01219 static local bit one_log = $test$plusargs("vmm_channel_shared_log");
01220 static local `VMM_LOG shared_log = null;
01221
01222 local int full = 0;
01223 local int empty = 0;