In this phase we will see the scoreboard implementation. Vmm has scoreboard classes with lot of features. For this example, we will write a simple scoreboard which is implemented using the vmm_xactor.
Scoreboard has 2 channels. One is used to for getting the packets from the driver and other from the receiver. Then the packets are compared and if they don't match, then error is asserted. For comparison, compare () method of the Packet class is used.
Scoreboard in implemented in file Scoreboard.sv.
1) Declare 2 channels drvr2sb_chan and rcvr2sb_chan.
3) Call the super.new() method and Connect the channels of the constructor to the channels of the scoreboard.
super.new("sb",inst,stream_id);
if(drvr2sb_chan == null)
`vmm_fatal(this.log,"drvr2sb_channel is not constructed"); else this.drvr2sb_chan = drvr2sb_chan;
if(rcvr2sb_chan == null)
`vmm_fatal(this.log,"rcvr2sb_channel is not constructed"); else this.rcvr2sb_chan = rcvr2sb_chan;
`vmm_note(log,"Scoreboard created ");
4) Define vmm_xactor main() method. First call the super.main() method and then do the following steps forever.
Wait until there is a packet is in "rcvr2sb_chan". Then pop the packet from channel.
rcvr2sb_chan.get(pkt_rcv);
$display(" %0d : Scorebooard : Scoreboard received a packet from receiver ",$time);
Then pop the packet from drvr2sb_chan.
drvr2sb_chan.get(pkt_exp);
Compare both packets and assert an error if the comparison fails using `vmm_error.
Run the simulation:
vcs -sverilog -f filelist -R -ntb_opts rvm
Log File Report:
******************* Start of testcase ****************
Normal[NOTE] on Environemnt() at 0:
Created env object
Normal[NOTE] on Environemnt() at 0:
Start of gen_cfg() method
Normal[NOTE] on Environemnt() at 0:
End of gen_cfg() method
Normal[NOTE] on Environemnt() at 0:
Start of build() method
Normal[NOTE] on driver(Drvr) at 0:
Driver created
Normal[NOTE] on Receiver(Rcvr-0) at 0:
Receiver created
Normal[NOTE] on Receiver(Rcvr-1) at 0:
Receiver created
Normal[NOTE] on Receiver(Rcvr-2) at 0:
Receiver created
Normal[NOTE] on Receiver(Rcvr-3) at 0:
Receiver created
Normal[NOTE] on sb(Sb) at 0:
Scoreboard created
Normal[NOTE] on Environemnt() at 0:
End of build() method
Normal[NOTE] on Environemnt() at 0:
Start of reset_dut() method
Normal[NOTE] on Environemnt() at 60:
End of reset_dut() method
Normal[NOTE] on Environemnt() at 60:
Start of cfg_dut() method
Normal[NOTE] on Environemnt() at 90:
Port 0 Address 00
Normal[NOTE] on Environemnt() at 110:
Port 1 Address 11
Normal[NOTE] on Environemnt() at 130:
Port 2 Address 22
Normal[NOTE] on Environemnt() at 150:
Port 3 Address 33
Normal[NOTE] on Environemnt() at 170:
End of cfg_dut() method
Normal[NOTE] on Environemnt() at 170:
Start of start() method
Normal[NOTE] on Environemnt() at 170:
End of start() method
Normal[NOTE] on Environemnt() at 170:
Start of wait_for_end() method
Normal[NOTE] on driver(Drvr) at 170:
started main task
Normal[NOTE] on Receiver(Rcvr-0) at 170:
started main task
Normal[NOTE] on Receiver(Rcvr-1) at 170:
started main task
Normal[NOTE] on Receiver(Rcvr-2) at 170:
started main task
Normal[NOTE] on Receiver(Rcvr-3) at 170:
started main task
size 8 ****
Normal[NOTE] on Receiver(Rcvr-0) at 470:
Received a packet
rcvr packet #0.0.0
rcvr da:0x00
rcvr sa:0xac
rcvr length:0x05 (data.size=4)
rcvr data[0]:0xcb data[1]:0x7e data[2]:0x52 data[3]:0xa4
rcvr fcs:0x29
470 : Scorebooard : Scoreboard received a packet from receiver
size 9 ****
Normal[NOTE] on Receiver(Rcvr-1) at 710:
Received a packet
rcvr packet #0.0.0
rcvr da:0x11
rcvr sa:0xf3
rcvr length:0x06 (data.size=5)
rcvr data[0]:0xc4 data[1]:0xd5 .... data[3]:0xf3 data[4]:0x88
rcvr fcs:0x5b
size 6 ****
Normal[NOTE] on Receiver(Rcvr-3) at 890:
Received a packet
rcvr packet #0.0.0
rcvr da:0x33
rcvr sa:0x6b
rcvr length:0x03 (data.size=2)
rcvr data[0]:0x32 data[1]:0x27
rcvr fcs:0x1c
Normal[NOTE] on Environemnt() at 10170:
End of wait_for_end() method
Normal[NOTE] on Environemnt() at 10170:
Start of stop() method
Normal[NOTE] on Environemnt() at 10170:
End of stop() method
Normal[NOTE] on Environemnt() at 10170:
Start of cleanup() method
Normal[NOTE] on Environemnt() at 10170:
End of cleanup() method
Normal[NOTE] on Environemnt() at 10170:
Start of report() method
---------------------------------------------------------------------
Simulation PASSED on /./ (/./) at 10170 (0 warnings, 0 demoted errors & 0 demoted warnings)
---------------------------------------------------------------------
Normal[NOTE] on Environemnt() at 10170:
End of report() method
******************** End of testcase *****************