Expanded versions of source files are the output of the preprocessor. Lines subject to conditional compilation are not shown and all compiler pragmas have been stripped. Macros have been completely expanded.
std_lib/xvc_action.sv unexpanded source
00001: // 00002: // ------------------------------------------------------------- 00003: // Copyright 2004-2008 Synopsys, Inc. 00004: // All Rights Reserved Worldwide 00005: // 00006: // Licensed under the Apache License, Version 2.0 (the 00007: // "License"); you may not use this file except in 00008: // compliance with the License. You may obtain a copy of 00009: // the License at 00010: // 00011: // http://www.apache.org/licenses/LICENSE-2.0 00012: // 00013: // Unless required by applicable law or agreed to in 00014: // writing, software distributed under the License is 00015: // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00016: // CONDITIONS OF ANY KIND, either express or implied. See 00017: // the License for the specific language governing 00018: // permissions and limitations under the License. 00019: // ------------------------------------------------------------- 00020: // 00021: 00022: 00023: 00024: function xvc_action::new(string name, 00025: vmm_log log); 00026: super.new(log); 00027: 00028: this.name = name; 00029: endfunction: new 00030: 00031: 00032: function string xvc_action::get_name(); 00033: get_name = this.name; 00034: endfunction: get_name 00035: 00036: 00037: function xvc_action xvc_action::parse(string argv[]); 00038: string msg = "Virtual xvc_action::parse() not implemented in derivative"; 00039: 00040: if (this.notify.log == null) begin 00041: $display(msg); 00042: $finish; 00043: end 00044: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00045: parse = null; 00046: endfunction: parse 00047: 00048: 00049: task xvc_action::execute(vmm_channel exec_chan, 00050: xvc_xactor xvc); 00051: string msg = "Virtual xvc_action::execute() not implemented in derivative"; 00052: if (this.notify.log == null) begin 00053: $display(msg); 00054: $finish; 00055: end 00056: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00057: endtask: execute 00058: 00059: 00060: function string xvc_action::psdisplay(string prefix); 00061: $sformat(psdisplay, "%0sXVC Action %0s #%0d.%0d.%0d", prefix, name, 00062: this.stream_id, this.scenario_id, this.data_id); 00063: endfunction: psdisplay 00064: 00065: 00066: function bit xvc_action::is_valid(bit silent, 00067: int kind); 00068: is_valid = 1; 00069: endfunction: is_valid 00070: 00071: 00072: function vmm_data xvc_action::allocate(); 00073: string msg = "Virtual xvc_action::allocate() not implemented in derivative"; 00074: 00075: if (this.notify.log == null) begin 00076: $display(msg); 00077: $finish; 00078: end 00079: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00080: allocate = null; 00081: endfunction: allocate 00082: 00083: 00084: function vmm_data xvc_action::copy(vmm_data to); 00085: string msg = "Virtual vmm_data::copy() not implemented in derivative"; 00086: 00087: if (this.notify.log == null) begin 00088: $display(msg); 00089: $finish; 00090: end 00091: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00092: copy = to; 00093: endfunction: copy 00094: 00095: 00096: function void xvc_action::copy_data(vmm_data to); 00097: xvc_action cpy; 00098: 00099: if (to == null) begin 00100: string msg = "xvc_action::copy_data() called with non xvc_action instance"; 00101: 00102: if (this.notify.log == null) begin 00103: $display(msg); 00104: $finish; 00105: end 00106: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00107: return; 00108: end 00109: 00110: if (!$cast(cpy, to)) begin 00111: string msg = "xvc_action::copy_data() called with null reference"; 00112: 00113: if (this.notify.log == null) begin 00114: $display(msg); 00115: $finish; 00116: end 00117: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00118: return; 00119: end 00120: 00121: super.copy_data(to); 00122: cpy.name = this.name; 00123: cpy.callbacks = this.callbacks; 00124: endfunction: copy_data 00125: 00126: 00127: function bit xvc_action::compare(input vmm_data to, 00128: output string diff, 00129: input int kind); 00130: string msg = "Virtual xvc_action::compare() not implemented in derivative"; 00131: if (this.notify.log == null) begin 00132: $display(msg); 00133: $finish; 00134: end 00135: else : do : if (this.notify.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin : void'(this.notify.log.text(msg)); : this.notify.log.end_msg(); : end : while (0); 00136: compare = 0; 00137: endfunction : compare 00138: 00139: 00140: function int unsigned xvc_action::byte_size(int kind); 00141: byte_size = this.name.len() + 1; 00142: endfunction : byte_size 00143: 00144: 00145: function int unsigned xvc_action::max_byte_size(int kind); 00146: max_byte_size = this.name.len() + 1; 00147: endfunction : max_byte_size 00148: 00149: 00150: function int unsigned xvc_action::byte_pack(ref logic [7:0] bytes[], 00151: input int unsigned offset, 00152: input int kind); 00153: int i; 00154: 00155: byte_pack = this.byte_size(kind); 00156: if (bytes.size() < offset + byte_pack) begin 00157: bytes = new [offset + byte_pack] (bytes); 00158: end 00159: for (i = 0; i < this.name.len(); i++) begin 00160: bytes[offset + i] = this.name.getc(i); 00161: end 00162: bytes[offset + i] = 8'h00; 00163: endfunction : byte_pack 00164: 00165: 00166: function int unsigned xvc_action::byte_unpack(const ref logic [7:0] bytes[], 00167: input int unsigned offset, 00168: input int len, 00169: input int kind); 00170: string space = ""; 00171: byte_unpack = 0; 00172: if (offset >= bytes.size()) return 0; 00173: if (len < 0) len = bytes.size() - offset; 00174: 00175: this.name = {len{space}}; 00176: while (len > 0 && bytes[byte_unpack + offset] != 8'h00) begin 00177: byte c = bytes[byte_unpack + offset]; 00178: this.name.putc(byte_unpack, c); 00179: byte_unpack++; 00180: len--; 00181: end 00182: if (byte_unpack > 0) begin 00183: // Truncate name to remove trailing " "s 00184: this.name = this.name.substr(0, byte_unpack-1); 00185: end 00186: // Include the terminating 8'h00 in unpack count 00187: if (len > 0) byte_unpack++; 00188: endfunction : byte_unpack