make runs=<number of tests> tests=<number of tests before coverage print>
correctkey
- makes sure key is `KEY when locking
- 33% change to guess correct key while unlocking
limittimer
- max limit of 255 on timerlongerrounds
-C_start
twice as likely to stay same than togglesomeonealwaysactive
- mask will never mask every bidder out
- using functions
getbids()
andgetinputs()
- called by
+probabilisticallyrandom
forvsim
, usemake random=true
to disable getinputs()
for inputs to fsm control- will always lock with macro
KEY
, 25% chance to use the same key to unlock - mask will always leave at least 1 bidder active
- cooldown timer can never be greater then 2^8
- 25% change to toggle
C_start
, make longer rounds and longer break between rounds
- will always lock with macro
gitbids()
for inputs to bidders+tokenstarved
to getINSUFFICIENT_FUNDS
errors+impatientbidder
to getROUND_INACTIVE
error+rudebidder
to bid whenC_start
is low, and not bid when high
- called by
lock()
andunlock()
tasks that use a pre-defined macro keymilliontokens()
to give each bidder a million tokensmakeAllBiddersWin()
- gives tokens to all bidders
- locks device
- starts rounds that lead to all bidders winning atleast once, at max 4 times
- can make only 1 bidder win with
+onlyonewinner
plusarg
maskout(int)
allows us manually mask bidders out
+bidderswinonce
- to callmakeAllBiddersWin()
+milliontokens
- to callmilliontokens()
and then lock the device+dontrandtillcomplete
- to skip randomization altogether for directed testing
- class
bidsrandomizer
- randomizes inputs to fsm and bidders
fsminputsrandomizer_t
struct used to declarefsminputs_t
struct asrand
bidsinputsrandomizer_t
struct used to declareNUMBIDDERS
xbiddersinputs_t
structs asrand
- no constraints for now
- randomizes inputs to fsm and bidders
- upon reset, do not start randomization instantly
- give every bidder a million tokens (
milliontokens()
) - lock device with key (
lock(KEY)
) - randomize till 100% coverage or number of runs exhausted
- simulation will try to continue till it gets to 100% coverage or tests reach a value
- can specify value maximum runs with
make runs=<value>
(default 10000) - can reduce / increase prints with
make tests=<value>
(default 1000)
- can specify value maximum runs with
- covergroup
bids22covergroup
- coverpoints
coverstates
-illegal_bin
used to excludeRESET
state from % coveragecoverstatetransitions
- as name stateslock
- stateUNLOCKED => LOCKED
unlock
- stateLOCKED => UNLOCKED
badkey
- stateLOCKED => COOLDOWN => LOCKED
round
- stateLOCKED => ROUNDSTARTED => ROUNDOVER => READYNEXT => LOCKED
- coverpoints
- covergroup
bids22coverbidders
- coverpoints
- 3x cover bidders winning - covering all bidders winning atleast once
- coverpoints
- covergroup
bids22outerrors
- coverpoints
coverfsmerrors
- check all fsm errors occuring- 3x cover bidders errors - check all errors occuring per bidder
- coverpoints
- report -
coverage.report
- detailed explanation of all bins and coverages at the start
- summary of all types of coverages at the end
- condition coverage
- covergroups coverage
- FSM state coverage
- FSM state transition coverage
- statement coverage
- issues found on reading the coverage report, found discrepancies
- all bidders were winners exactly same number of times
- further directed testing with just 1 possible winner done
- the fsm was outputting correctly when verifying with display statements on
posedge clk
- the coverage was taking one winner as win for all coverpoints, this gave false 100% win coverage
INSUFFICIENT_FUNDS
did not show up in coverage- with above directed testing, one bidder was also given
X
tokens andX
bidAmt - due to
bidCost
this should fail with errorINSUFFICIENT_FUNDS
- this can be seen with debug display statement, but coverage report does not list this happening
- with above directed testing, one bidder was also given
- all bidders were winners exactly same number of times
- targets -
all
- doesvlib -> vlog -> vsim -> zip
vlib
- makeswork
libraryvlog
- compiles all files listed inSRC_FILES
vsim
- simulateswork.top
(has pre-requisitevlog
)zip
- makes zipfile for submissionclean
- deletes all deletable files (REMOVABLE_STUFF
)
bidsinterface.sv
- everything required for interfacebids22defs
- enum definitions for opcodes, error codes for bidders, and error codes for
bids22
output - structure definitions for bidders' inputs and outputs (
inputs_t
andoutputs_t
)
- enum definitions for opcodes, error codes for bidders, and error codes for
bids22interface
- actual interface that defines all ports as inputs outputs as required- only 1 modport as everything is hardcoded
- could be extended to modports for all bidders, but I don't see how that's helpful
bids.sv
- actual bids22 machine's fsm code- parameterized - can make more bidders with
NUMBIDDERS
parameter- default 3
- X =
bidder[0]
, Y =bidder[1]
, Z =bidder[2]
- states -
RESET
- falisafe state, shouldn't never end up hereUNLOCKED
- state on coming out of reset, allows setting up the parametersCOOLDOWN
- wait state if wrong key was entered while unlocking, wait for timer countdownLOCKED
- expected state after providing key in unlocked state (default 0), bids22 accepts C_start nowROUNDSTARTED
- bids from bidders now accepted, bidcost is also subtracted here per bidROUNDOVER
- decision on who won, goes toREADYNEXT
READYNEXT
- ¯\_(ツ)_/¯, goes toLOCKED
- parameterized - can make more bidders with
- testing for when X bids the highest amount, Y bids the highest amount and Z bids the highest amount
- testing for global errors -
- trying to unlock with a bad key
- trying to unlock whilst in unlocked state
C_start
asserted when already in unlocked state- invalid operation when opcode is not matching the given list
- checking for when two bidders bid the same amount amounting to duplicate bids error
- testing for bidders’ errors -
- testing for insufficient funds when the bid amount outweighs the value/balance for particular bidder
- testing for mask for particular bidder goes zero at the same time bidder makes a bid
- testing for bids being placed when
C_start
is low