I am trying my hand on VMM and have develop a small evnironment of Ethernet.
It is working Ok, but i cannot control the generation through the testcase and default execution takes place.
Attaching the code, would appreciate if VMM gurus point out my mistakes and indicate needed/unneeded code or part that i am missing.
The code that need the attention is marked in "red".
The /**** ***/ denotes code in file.
/****************************** Package **********************************/
package vcp_eth_package;
typedef enum logic Ώ:0] {ETHER, VLAN, PAUSE} ether_frame_e;
typedef enum logic Ώ:0] {UNICAST, MULTICAST, BROADCAST, PROMISCUOUS} ether_addr_e;
endpackage
/****************************** Interface **********************************/
interface vcp_eth_interface(input Clk);
logic Ε:0] Data;
logic TxEn;
logic Col;
logic Crs;
logic Rst;
clocking transmit_cb @(posedge Clk);
default input #1 output #1;
output Data;
output TxEn;
input Col;
input Crs;
output Rst;
endclocking
clocking receive_cb @(posedge Clk);
default input #1 output #1;
input Data;
input TxEn;
output Col;
output Crs;
input Rst;
endclocking
modport Transmit (clocking transmit_cb );
modport Receive (input Data, TxEn, Rst, Clk,
output Col, Crs);
endinterface
/****************************** Configuration **********************************/
import vcp_eth_package::*;
class vcp_eth_cfg;
vmm_log log;
rand ether_addr_e ether_addr;
rand integer transactionCount;
constraint trans_cnt {
transactionCount inside {ΐ:3]};
}
function new;
log = new ("Configuration", "Class");
endfunction
endclass
/****************************** Frame **********************************/
class vcp_eth_frame;
// Class Members
// Fields of Ethernet Frame
// Kind Field
ether_addr_e ether_addr;
rand ether_frame_e frame_type;
constraint valid_frame_type {
frame_type inside {[ETHER:VLAN]};
}
// Physical Field
rand logic ⏃:0] preamble;
constraint valid_preamble {
preamble == 56'haaaa_aaaa_aaaa_aa;
}
rand logic Ε:0] sfd;
constraint valid_sfd {
sfd == 8'hab;
}
rand logic ⎻:0] destAddress;
constraint valid_dstAddr {
if (ether_addr == UNICAST)
{
destAddress == 48'h0011_2233_4455;
} else
if (ether_addr == MULTICAST)
{
destAddress == 48'haabb_ccdd_eeff;
} else
if (ether_addr == BROADCAST)
{
destAddress == 48'hffff_ffff_ffff;
} else
{
destAddress inside {48'h0123_4567_89ab, 48'h0cde_f012_3456};
}
}
rand logic ⎻:0] srcAddress;
constraint valid_srcAddr {
srcAddress == 48'h0abb_ccdd_eeff;
}
rand logic ⎛:0] length_type;
rand logic [ 2:0] user_priority;
rand logic cfi;
rand logic ⎗:0] vlan_id;
rand logic Ε:0] data[]
constraint valid_data {
length_type inside {⎺:1500]};
data.size() == length_type;
foreach (data)
data inside {0,10,20,30,40,50,60};
}
rand logic ⎫:0] crc32;
constraint valid_fcs {
crc32 == 32'h0000_0000;
}
function new ();
endfunction
// extern virtual function ⎫:0] compute_fcs();
endclass
/****************************** Transaction **********************************/
class vcp_eth_transaction extends vmm_data;
// Class Member Objects
vcp_eth_cfg cfg;
vmm_log log = new ("Transaction", "Class");
// Fields of Ethernet Frame
rand vcp_eth_frame frame;
extern function new (vcp_eth_cfg cfg = null);
extern virtual function string psdisplay(string prefix = "");
extern virtual function vmm_data allocate();
extern virtual function vmm_data copy (vmm_data to = null);
extern virtual function void copy_data(vmm_data to = null);
extern virtual function bit compare (vmm_data to,
output string diff,
input int kind = -1);
extern virtual function bit is_valid (bit silent = 1,
int kind = -1);
extern virtual function int unsigned byte_size (int kind = -1);
extern virtual function int unsigned byte_pack (ref logic Ε:0] bytes[],
input int unsigned offset = 0,
input int kind = -1);
// extern virtual function int unsigned byte_unpack(const ref logic Ε:0] bytes[],
// input int len = -1,
// input int kind = -1);
endclass
`vmm_channel(vcp_eth_transaction)
`vmm_atomic_gen(vcp_eth_transaction, "Ethernet Generator")
//-----------------------------------------------------------------------------
// new() - VMM
//-----------------------------------------------------------------------------
function vcp_eth_transaction::new (vcp_eth_cfg cfg);
super.new(this.log);
if(cfg == null)
this.cfg = new();
else
this.cfg = cfg;
frame = new();
endfunction
//-----------------------------------------------------------------------------
// allocate() - VMM
//-----------------------------------------------------------------------------
function vmm_data vcp_eth_transaction::allocate();
// Allocate a new object of this type, and return a handle to it
vcp_eth_transaction i = new();
allocate = i;
endfunction: allocate
//-----------------------------------------------------------------------------
// copy() - VMM
//-----------------------------------------------------------------------------
function vmm_data vcp_eth_transaction::copy(vmm_data to);
vcp_eth_transaction cpy;
// Construct a new object if needed, check the type if 'to' specified
if (to == null)
cpy = new(this.cfg);
else if (!$cast(cpy, to)) begin
`vmm_error(this.log, "Cannot copy to non-eth_trans instance");
copy = null;
// return;
end
// Copy the data fields into the 'to' object and return cpy
copy_data(cpy);
copy = cpy;
endfunction: copy
//-----------------------------------------------------------------------------
// copy_data() - VMM
//-----------------------------------------------------------------------------
function void vcp_eth_transaction::copy_data(vmm_data to);
vcp_eth_transaction cpy;
// Copy all the VMM base class data
super.copy_data(to);
if (!$cast(cpy, to)) begin
`vmm_error(this.log, "Cannot copy to non-eth_trans instance");
// return;
end
case (this.frame.frame_type)
ETHER : begin
cpy.frame.preamble = this.frame.preamble;
cpy.frame.sfd = this.frame.sfd;
cpy.frame.destAddress = this.frame.destAddress;
cpy.frame.srcAddress = this.frame.srcAddress;
cpy.frame.length_type = this.frame.length_type;
cpy.frame.data = this.frame.data;
cpy.frame.crc32 = this.frame.crc32;
end
VLAN : begin
cpy.frame.preamble = this.frame.preamble;
cpy.frame.sfd = this.frame.sfd;
cpy.frame.destAddress = this.frame.destAddress;
cpy.frame.srcAddress = this.frame.srcAddress;
cpy.frame.cfi = this.frame.cfi;
cpy.frame.user_priority = this.frame.user_priority;
cpy.frame.vlan_id = this.frame.vlan_id;
cpy.frame.length_type = this.frame.length_type;
cpy.frame.data = this.frame.data;
cpy.frame.crc32 = this.frame.crc32;
end
endcase
endfunction: copy_data
//-----------------------------------------------------------------------------
// compare - VMM
//-----------------------------------------------------------------------------
function bit vcp_eth_transaction::compare(vmm_data to,
output string diff,
input int kind);
vcp_eth_transaction frm;
compare = 1;
// Check the type is correct
if (to == null || !$cast(frm, to)) begin
`vmm_error(this.log, "Cannot compare to non-eth_trans instance");
compare = 0;
// return;
end
if (frm.frame.preamble !== this.frame.preamble) begin
$sformat(diff, "Preamble (%s !== %s)", this.frame.preamble, frm.frame.preamble);
compare = 0;
end
if (frm.frame.sfd !== this.frame.sfd) begin
$sformat(diff, "Preamble (%s !== %s)", this.frame.sfd, frm.frame.sfd);
compare = 0;
end
if (frm.frame.destAddress !== this.frame.destAddress) begin
$sformat(diff, "Preamble (%s !== %s)", this.frame.destAddress, frm.frame.destAddress);
compare = 0;
end
if (frm.frame.srcAddress !== this.frame.srcAddress) begin
$sformat(diff, "Preamble (%s !== %s)", this.frame.srcAddress, frm.frame.srcAddress);
compare = 0;
end
endfunction: compare
//-----------------------------------------------------------------------------
// psdisplay() - VMM
//-----------------------------------------------------------------------------
function string vcp_eth_transaction::psdisplay(string prefix);
case (this.frame.frame_type)
ETHER:
$sformat(psdisplay, "%s#%0d.%0d.%0d : 802.3 Packet \
Preamble = %0x, \
SFD = %0x, \
Destination Address = %0x, \
Source Address = %0x, \
Length/Type = %0d, \
CRC32 = %0x",
prefix, this.stream_id, this.scenario_id, this.data_id,
this.frame.preamble, this.frame.sfd, this.frame.destAddress,
this.frame.srcAddress, this.frame.length_type, this.frame.crc32);
VLAN:
$sformat(psdisplay, "%s#%0d.%0d.%0d : VLAN Packet \
Preamble = %0x, \
SFD = %0x,\
Destination Address = %0x,\
Source Address = %0x,\
CFI = %0b,\
Priority = %0d,\
VLAN ID = %0x,\
Length/Type = %0d,\
CRC32 = %0x",
prefix, this.stream_id, this.scenario_id, this.data_id,
this.frame.preamble, this.frame.sfd, this.frame.destAddress,
this.frame.srcAddress, this.frame.cfi, this.frame.user_priority,
this.frame.vlan_id, this.frame.length_type, this.frame.crc32);
default:
$sformat(psdisplay, "%s#%0d.%0d.%0d : Unknown ---------------------",
prefix, this.stream_id, this.scenario_id, this.data_id);
endcase
endfunction: psdisplay
//-----------------------------------------------------------------------------
// is_valid() - VMM
//-----------------------------------------------------------------------------
function bit vcp_eth_transaction::is_valid(bit silent,
int kind);
is_valid = 1;
endfunction: is_valid
//-----------------------------------------------------------------------------
// byte_size() - VMM
//-----------------------------------------------------------------------------
function int unsigned vcp_eth_transaction::byte_size(int kind);
if (this.frame.frame_type == ETHER)
begin
byte_size = (this.frame.data.size() + 26);
end
else if (this.frame.frame_type == VLAN)
begin
byte_size = (this.frame.data.size() + 28);
end
endfunction: byte_size
//-----------------------------------------------------------------------------
// byte_pack() - VMM
//-----------------------------------------------------------------------------
function int unsigned vcp_eth_transaction::byte_pack(ref logic Ε:0] bytes[],
input int unsigned offset,
input int kind);
int p_c = 0;
int byteSize = 0;
logic Ε:0] temp_data[]
void'(frame.randomize());
byteSize = byte_size(0);
temp_data = new[byteSize]
temp_dataΎ] = this.frame.preambleΕ:0]
temp_dataΏ] = this.frame.preamble⎛:8]
temp_dataΐ] = frame.preamble⎣:16]
temp_dataΑ] = frame.preamble⎫:24]
temp_dataΒ] = frame.preamble⎴:32]
temp_dataΓ] = frame.preamble⎻:41]
temp_dataΔ] = frame.preamble⏃:48]
temp_dataΕ] = frame.sfd;
temp_dataΖ] = frame.destAddressΕ:0]
temp_dataΗ] = frame.destAddress⎛:8]
temp_data⎖] = frame.destAddress⎣:16]
temp_data⎗] = frame.destAddress⎫:24]
temp_data⎘] = frame.destAddress⎴:32]
temp_data⎙] = frame.destAddress⎻:41]
temp_data⎚] = frame.srcAddressΕ:0]
temp_data⎛] = frame.srcAddress⎛:8]
temp_data⎜] = frame.srcAddress⎣:16]
temp_data⎝] = frame.srcAddress⎫:24]
temp_data⎞] = frame.srcAddress⎴:32]
temp_data⎟] = frame.srcAddress⎻:41]
temp_data⎠] = frame.length_typeΕ:0]
temp_data⎡] = frame.length_type⎛:8]
p_c = 22;
if (frame.frame_type == VLAN)
begin
temp_data⎢] = {frame.user_priority, frame.cfi, frame.vlan_id⎗:8]};
temp_data⎣] = frame.vlan_idΕ:0]
p_c = 24;
end
for (int pc = 0; pc < frame.data.size(); pc++, p_c++)
begin
temp_data[p_c] = frame.data[pc]
end
// frame.crc32 = this.crc32_compute();
temp_data[p_c] = frame.crc32Ε:0]
temp_data[p_c+1] = frame.crc32⎛:8]
temp_data[p_c+2] = frame.crc32⎣:16]
temp_data[p_c+3] = frame.crc32⎫:24]
bytes = new[temp_data.size()]
foreach (temp_data)
bytes = temp_data;
byte_pack = bytes.size(); // Return the number of bytes packed
endfunction: byte_pack
//-----------------------------------------------------------------------------
// byte_unpack() - VMM
//-----------------------------------------------------------------------------
// function int unsigned vcp_eth_transaction::byte_unpack(const ref logic Ε:0] bytes[],
// input int len,
// input int kind);
//
// frame.data = {bytes[offset], bytes[offset+1], bytes[offset+2], bytes[offset+3]};
//
// byte_unpack = byte_size(); // Return the number of bytes unpacked
//
// endfunction: byte_unpack
/****************************** Master **********************************/
`define ETHER_TRANSMIT_IF eth_transmit.transmit_cb
class vcp_eth_master extends vmm_xactor;
// Ethernet Interface Transmit Side
virtual vcp_eth_interface.Transmit eth_transmit;
// Ethernet Transaction Channel
vcp_eth_transaction_channel ethernet_ch;
extern function new(string instance,
integer stream_id = -1,
virtual vcp_eth_interface.Transmit eth_transmit,
vcp_eth_transaction_channel ethernet_ch = null);
extern virtual task main();
extern virtual task reset();
// extern protected virtual task do_read(ref vcp_eth_transaction tr) ;
extern protected virtual task do_write(vcp_eth_transaction tr) ;
extern protected virtual task do_idle();
endclass
//-----------------------------------------------------------------------------
// new() - Constructor
//-----------------------------------------------------------------------------
function vcp_eth_master::new(string instance,
integer stream_id,
virtual vcp_eth_interface.Transmit eth_transmit,
vcp_eth_transaction_channel ethernet_ch);
super.new("Ethernet", instance, stream_id);
this.eth_transmit = eth_transmit;
if (ethernet_ch == null) ethernet_ch = new("Ethernet Transmit Input Channel", instance);
this.ethernet_ch = ethernet_ch;
endfunction
//-----------------------------------------------------------------------------
// ETH Master Callback Class
//-----------------------------------------------------------------------------
virtual class vcp_eth_master_callbacks extends vmm_xactor_callbacks;
// Callbacks before a transaction is started
virtual task master_pre_tx(vcp_eth_master xactor,
ref vcp_eth_transaction trans,
ref bit drop);
endtask
// Callback after a transaction is completed
virtual task master_post_tx(vcp_eth_master xactor,
vcp_eth_transaction trans);
endtask
endclass: vcp_eth_master_callbacks
//-----------------------------------------------------------------------------
// main() - RVM main
//-----------------------------------------------------------------------------
// Main daemon. Runs forever to switch Ethernet transaction to
// corresponding read/write/idle command
//-----------------------------------------------------------------------------
task vcp_eth_master::main();
vcp_eth_transaction tr;
bit drop;
// Start the super.main() to perform any base-class task
super.main();
// Main loop to drive bus
forever begin
// $cast(tr, randomized_obj.copy());
// Get a transaction from the input channel
this.wait_if_stopped_or_empty(this.ethernet_ch) ;
ethernet_ch.get(tr);
// Pre-Tx callback
`vmm_callback(vcp_eth_master_callbacks, master_pre_tx(this, tr, drop));
if (drop == 1) begin
`vmm_note(log, tr.psdisplay("Dropped"));
continue;
end
// case (tr.trans_dir)
// READ: do_read(tr);
// WRITE: do_read(tr);
// default : do_idle();
// endcase
do_write(tr);
`vmm_callback(vcp_eth_master_callbacks, master_post_tx(this, tr));
// Debug Print
`vmm_note(log, tr.psdisplay("Transmit ==>"));
end
endtask
//-----------------------------------------------------------------------------
// reset() - Reset the Ethernet Bus to the default values, then go into active mode
//-----------------------------------------------------------------------------
task vcp_eth_master::reset();
`ETHER_TRANSMIT_IF.Rst <= 0;
do_idle();
repeat (2) @(`ETHER_TRANSMIT_IF);
`ETHER_TRANSMIT_IF.Rst <= 1;
repeat (5) @(`ETHER_TRANSMIT_IF);
`ETHER_TRANSMIT_IF.Rst <= 0;
endtask: reset
//-----------------------------------------------------------------------------
// do_idle() - Put the Ethernet Bus into Idle Mode
//-----------------------------------------------------------------------------
task vcp_eth_master::do_idle();
`ETHER_TRANSMIT_IF.Data <= 8'h00;
`ETHER_TRANSMIT_IF.TxEn <= 0;
endtask: do_idle
//----------------------------------------------------------------------
// do_write() - Issue an ETH Write Cycle
//----------------------------------------------------------------------
task vcp_eth_master::do_write(vcp_eth_transaction tr);
logic Ε:0] tmp_data[]
tr.byte_pack(tmp_data, 0, 1);
// Drive Control bus
`ETHER_TRANSMIT_IF.TxEn <= 1'b1;
for (int i= 0; i < tmp_data.size(); i++)
begin
`ETHER_TRANSMIT_IF.Data <= tmp_data;
@(`ETHER_TRANSMIT_IF);
end
// Deassert it
##1 `ETHER_TRANSMIT_IF.TxEn <= 1'b0;
repeat (12) @(`ETHER_TRANSMIT_IF);
endtask: do_write
/****************************** Env **********************************/
class vcp_eth_env extends vmm_env;
integer time_out = 100000;
// Class Member Objects
// ETH Transmit Interface
virtual vcp_eth_interface if_master;
// Configuration Handle, vcp_eth_cfg, with name if_master.
vcp_eth_cfg cfg;
// Generator Handle, vcp_eth_transaction_atomic_gen called gen
vcp_eth_transaction_atomic_gen gen;
// Xactor Handle, vcp_eth_master, with name master.
vcp_eth_master master;
// Handle for Channel from generator to master
vcp_eth_transaction_channel gen2mas;
// VMM Logger for messages.
vmm_log log;
// VMM Environment Steps
extern function new (virtual vcp_eth_interface if_master);
extern virtual function void gen_cfg();
extern virtual function void build();
extern virtual task reset_dut();
extern virtual task start();
extern virtual task wait_for_end();
extern virtual task stop();
extern virtual task cleanup();
extern virtual task report();
// Non Vmm methods
extern virtual task Global_timeout();
endclass
//-----------------------------------------------------------------------------
// new() - constructor, pass in any virtual ports needed to connect to DUT
//-----------------------------------------------------------------------------
function vcp_eth_env::new(virtual vcp_eth_interface if_master);
super.new("ETH Environment");
this.log = new ("Environment", "Ether0");
`vmm_note(this.log," ENV CREATED ");
this.if_master = if_master;
this.cfg = new();
this.log.stop_after_n_errors(1);
endfunction
//-----------------------------------------------------------------------------
// gen_cfg() - Generate a randomized testbench configuration
//-----------------------------------------------------------------------------
function void vcp_eth_env::gen_cfg();
super.gen_cfg();
`vmm_note(this.log," Starting... Gen_cfg ");
if (cfg.randomize() == 0)
`vmm_fatal(log, "Failed to randomize testbench configuration");
`vmm_note(log, $psprintf("Number of Transactions = %0d", cfg.transactionCount));
endfunction
//-----------------------------------------------------------------------------
// build() - Build the testbench, xactors, scoreboard, callbacks
//-----------------------------------------------------------------------------
function void vcp_eth_env::build();
super.build();
`vmm_note(this.log," Starting... build ");
gen2mas = new ("ETH Trans Channel", "gen2mas");
gen = new ("ETH Atomic Gen", 1, gen2mas);
master = new ("Ethernet Transmit", 1, if_master, gen2mas );
gen.stop_after_n_insts = cfg.transactionCount;
endfunction: build
//-----------------------------------------------------------------------------
// reset_dut() - Reset the DUT
//-----------------------------------------------------------------------------
task vcp_eth_env::reset_dut();
super.reset_dut();
`vmm_note(this.log," Starting... reset_dut ");
master.reset();
`vmm_note(this.log," Ending... reset_dut ");
endtask:reset_dut
//-----------------------------------------------------------------------------
// start() - Start each of the xactors
//-----------------------------------------------------------------------------
task vcp_eth_env::start();
super.start();
`vmm_note(this.log," Starting... start ");
gen.start_xactor();
master.start_xactor();
endtask: start
//-----------------------------------------------------------------------------
// wait_for_end() - Wait until the test completes
//-----------------------------------------------------------------------------
task vcp_eth_env::wait_for_end();
super.wait_for_end();
`vmm_note(this.log," Starting... wait_for_end ");
repeat(30)@(posedge if_master.Clk);
// fork//watchdog
// begin
// Global_timeout();
// `vmm_note(this.log," Watchdog timeout occured ");
// end
// join_any
gen.notify.wait_for(vcp_eth_transaction_atomic_gen:
ONE);
endtask: wait_for_end
//-----------------------------------------------------------------------------
// stop() - Stop each of the xactors
//-----------------------------------------------------------------------------
task vcp_eth_env::stop();
super.stop();
`vmm_note(this.log," Starting... stop ");
gen.stop_xactor();
master.stop_xactor();
`vmm_note(this.log," Ending ... stop ");
endtask: stop
//-----------------------------------------------------------------------------
// cleanup() - Cleanup the testbench, report any scoreboard errors etc.
//-----------------------------------------------------------------------------
task vcp_eth_env::cleanup();
super.cleanup();
`vmm_note(this.log," Starting... cleanup ");
endtask
//-----------------------------------------------------------------------------
// report() - Report Statistics from the testbench
//-----------------------------------------------------------------------------
task vcp_eth_env::report();
super.report();
`vmm_note(this.log," Starting... report ");
$display("\t***********************************************");
log.report();
$display("\t***********************************************");
$display("\t***********************************************");
endtask
task vcp_eth_env::Global_timeout();
repeat(time_out) @(posedge if_master.Clk);
endtask
/***************************** Mem ************************************/
module mem(vcp_eth_interface.Receive eth);
always @(posedge eth.Clk)
begin: do_reset
if (eth.Rst === 1'b1)
begin
disable mgmt_if;
eth.Col <= 1'b0;
eth.Crs <= 1'b0;
end
end
always @(posedge eth.Clk)
begin: mgmt_if
if(eth.TxEn === 1'b1) begin
$display("Data is %x",eth.Data);
end
end
endmodule
/***************************** Top.v ************************************/
module vcp_eth_top;
parameter sim_cycle = 50;
vmm_log log;
bit clk;
initial begin
log = new ("TOP", 1);
end
always #(sim_cycle/2)
clk = ~clk;
// Instantiate the Program block
vcp_eth_interface eth(clk);
test t1(eth.Transmit);
mem m1(eth.Receive);
initial $vcdpluson();
endmodule
/************************ Testcase 1 ********************/
program test(vcp_eth_interface if_master);
vcp_eth_env env;
initial begin
env = new(if_master) ;
env.build();
begin
vcp_eth_transaction trans = new(); // Here-1
env.gen.randomized_obj = trans; // Here-1
env.run();
end
end
endprogram
/************************ Testcase 2 ********************/
program test(vcp_eth_interface if_master);
vcp_eth_env env;
class my_vcp_eth_trans extends vcp_eth_transaction;
env.cfg.transactionCount == 3;
endclass
initial begin
env = new(if_master) ;
env.build();
begin
vcp_eth_transaction trans = new(); // Here-1
env.gen.randomized_obj = trans; // Here-1
my_vcp_eth_trans trans = new(); // Here-2
env.gen.randomized_obj = trans; // Here-2
env.run();
end
end
endprogram
/************************ Makefile ********************/
################## COMMON #########################
VCS = vcs
RTL = vmm.sv vcp_eth_package.sv vcp_eth_top.sv vcp_eth_interface.sv mem.v
DGN = vcp_eth_cfg.sv vcp_eth_frame.sv vcp_eth_transaction.sv vcp_eth_master.sv vcp_eth_env.sv
OPT = -sverilog -debug_all -ntb_opts dtm -l vcp_eth_log.log
INC = +incdir+design+hdl+include
CMP =
RUN =
DIR = $(shell basename `pwd`)
################## VCS #########################
vcp_eth: build run
cov:
urg -dir .
cp:
cp -f ../design/*.sv .
cp -f ../include/*.sv .
build: cp
$(VCS) $(OPT) $(INC) $(RTL) $(DGN) ../tests/test.sv -R $(CMP)
run:
./simv $(RUN)
################## HELP #########################
help:
@echo "Usage::./runsim.csh test.sv"
################## Clean #########################
clean:
@rm -rf *.sv *.vro simv* csrc* *.vshell depchk*vr */*~
@rm -rf .__snps* *.db* *.vpd* *.log *~ obj scs* work DVEfiles
@rm -rf *.fcov *.html .vhdl.assert* .vlog.assert* vc_hdrs.h
@rm -rf sim.files
/************************ runsim ********************/
#!/bin/csh
if ($#argv == 0) then
echo " "
echo "============================================================== "
echo " User needs to give minimum one argument "
echo " USAGE "
echo " runtest.csh "
echo "============================================================== "
echo " "
exit 0
else
echo " ***********************************************"
echo " Script to run vcp_eth with VCS "
echo " usage : runsim.csh "
echo " ***********************************************"
endif
/******* Set the path here for your CWD *****/
setenv vcp_eth /vmm/vcp_eth
echo "$vcp_eth"
cd $vcp_eth/sim
rm -rf work/
cp -f $vcp_eth/include/*.sv $vcp_eth/sim/
cp -f $vcp_eth/tests/$1 test.sv
cp -f $vcp_eth/design/*.sv $vcp_eth/sim/
cp -f $vcp_eth/hdl/* $vcp_eth/sim/
cp -f $vcp_eth/scripts/Makefile $vcp_eth/sim/
make vcp_eth
rm -rf *.sv Makefile
- Thanks in advance.