VMM - (expanded) HAL/vmm_hw_arch_null.sv

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.

HAL/vmm_hw_arch_null.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: 
00025: `define VMM_HW_ARCH_NULL__SV
00026: 
00027: typedef class vmm_hw_arch_null_in_port;
00028: typedef class vmm_hw_arch_null_out_port;
00029: 
00030: class vmm_hw_arch_null extends vmm_hw_arch;
00031:    virtual function vmm_hw_in_port  create_in_port(virtual vmm_hw_in_if in_if,
00032:                                                    string               name);
00033:       vmm_hw_arch_null_in_port port = new(in_if);
00034:       return port;
00035:    endfunction: create_in_port
00036: 
00037:    virtual function vmm_hw_out_port create_out_port(virtual vmm_hw_out_if out_if,
00038:                                                     string                name);
00039:       vmm_hw_arch_null_out_port port = new(out_if);
00040:       return port;
00041:    endfunction: create_out_port
00042: 
00043:    virtual function string connect_to(string hdl_path,
00044:                                       string name);
00045:       return super.connect_to(hdl_path, name);
00046:    endfunction: connect_to
00047: 
00048:    virtual function void clk_control(virtual vmm_hw_clock clk,
00049:                                      virtual vmm_hw_clock_control ctl);
00050:       int n;
00051: 
00052:       ctl.cclk_en = 0;
00053:       ctl.cclk_neg_en = 0;
00054: 
00055:       n = clk.controller.size();
00061: 
00062:       fork
00063:          automatic int i = n;
00064: 
00065:          forever begin
00069:             wait (ctl.rdy_for_cclk === 1'b0);
00073:             clk.no_pos++;
00074:             wait (ctl.rdy_for_cclk === 1'b1);
00075:             clk.no_pos--;
00076:          end
00077: 
00078:          forever begin
00082:             wait (ctl.rdy_for_cclk_neg === 1'b0);
00086:             clk.no_neg++;
00087:             wait (ctl.rdy_for_cclk_neg === 1'b1);
00088:             clk.no_neg--;
00089:          end
00090: 
00091:          forever begin
00092:             ctl.cclk_en = clk.ck_en;
00093:             @ (clk.ck_en);
00094:          end
00095: 
00096:          forever begin
00097:             ctl.cclk_neg_en = clk.ckn_en;
00098:             @ (clk.ckn_en);
00099:          end
00100:       join_none
00101:    endfunction: clk_control
00102: endclass: vmm_hw_arch_null
00103: 
00104: 
00105: class vmm_hw_arch_null_in_port extends vmm_hw_in_port;
00106:    
00107:    local virtual vmm_hw_in_if itf;
00108: 
00109:    function new(virtual vmm_hw_in_if itf);
00110:       log.set_instance(itf.path);
00111: 
00112:       this.itf = itf;
00113:       this.itf.tx_rdy = 1'b0;
00114:    endfunction: new
00115: 
00116:    virtual function bit is_rdy();
00117:       return this.itf.rx_rdy;
00118:    endfunction: is_rdy
00119: 
00120:    virtual task wait_is_rdy();
00121:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text("Waiting for RTL to be ready to receive message...")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00122:       do begin
00123:          @(this.itf.ck);
00124:       end
00125:       while (this.itf.rx_rdy !== 1'b1);
00126:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text("RTL is ready to receive message")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00127:    endtask: wait_is_rdy
00128: 
00129:    virtual task send(bit [1024-1:0]  data);
00130:       if (this.itf.in_use) begin
00131:          
     : do 
     :    if (log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin 
     :       void'(log.text("send() task concurrently activated")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00132:       end
00133:       this.itf.in_use  = 1;
00134:       @(this.itf.ck);
00135:       this.itf.tx_rdy <= 1'b1;
00136:       this.itf.msg    <= data;
00137:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text("Waiting to send message...")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00138:       do begin
00139:          @(this.itf.ck);
00140:       end
00141:       while (this.itf.ck.rx_rdy !== 1'b1);
00142:       this.itf.tx_rdy <= 1'b0;
00143:       this.itf.in_use  = 0;
00144:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text($psprintf("Sent message 'h%h", this.itf.msg))); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00145:    endtask: send
00146: endclass: vmm_hw_arch_null_in_port
00147: 
00148: 
00149: class vmm_hw_arch_null_out_port extends vmm_hw_out_port;
00150:    local virtual vmm_hw_out_if itf;
00151: 
00152:    function new(virtual vmm_hw_out_if itf);
00153:       log.set_instance(itf.path);
00154: 
00155:       this.itf = itf;
00156:       this.itf.rx_rdy = 1'b0;
00157:    endfunction: new
00158: 
00159:    virtual function bit is_rdy();
00160:       return this.itf.tx_rdy;
00161:    endfunction: is_rdy
00162: 
00163:    virtual task wait_is_rdy();
00164:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text("Waiting for RTL to be ready to send message...")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00165:       do begin
00166:          @(this.itf.ck);
00167:       end
00168:       while (this.itf.ck.tx_rdy !== 1'b1);
00169:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text("RTL is ready to send message")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00170:    endtask: wait_is_rdy
00171: 
00172:    virtual task receive(ref bit [1024-1:0] data,
00173:                         ref time                            stamp);
00174:       if (this.itf.in_use) begin
00175:          
     : do 
     :    if (log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV)) begin 
     :       void'(log.text("receive() task concurrently activated")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00176:       end
00177:       this.itf.in_use  = 1;
00178:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text("Waiting to receive message...")); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00179:       @(this.itf.ck);
00180:       this.itf.rx_rdy <= 1'b1;
00181:       do
00182:          @(this.itf.ck);
00183:       while (this.itf.ck.tx_rdy !== 1'b1);
00184:       this.itf.rx_rdy <= 1'b0;
00185:       this.itf.in_use  = 0;
00186:       data  = this.itf.ck.msg;
00187:       stamp = vmm_hw.stamp;
00188:       
     : do 
     :    if (log.start_msg(vmm_log::DEBUG_TYP, vmm_log::DEBUG_SEV)) begin 
     :       void'(log.text($psprintf("Receive message 'h%h stamped %0d", data, stamp))); 
     :       log.end_msg(); 
     :    end 
     : while (0);
00189:    endtask: receive
00190: endclass: vmm_hw_arch_null_out_port
00191: