The question is as follows -
Write a monitor for a scenario of a serial 4 bit wide signal being received from the interface output. The condition is that the payload which we will send from monitor to scoreboard(via Analysis port) will be in the following format -
ABCD______<Payload>______CAFE
Condition is -
Once you receive ABCD continuously from output this will start the payload data to come and will continue till I receive CAFE if 4 nibbles continuously.
Please use signals as you wish for writing the driver run phase.
I have posted the solution below, I wanted to make sure there is nothing wrong w.r.t. to clock cycle sampling i.e. if there is any miss regarding to sampling at wrong timing. Also any additional input you think that may improve this piece of code.
I am seeing two issues here. You can explain these.
if(capture ==1)
begin
##1
payload = {payload, vif.data};
end
if payload is fixed size let’s say size of the data, then how are you assigning like above? shouldn’t it be as below.
payload = vif.data;
or should same logic as in your shift register, but then your payload data is lost.
if(shift_reg == 16'CAFE && capture)
begin
capture = 0;
analysis_port.write(payload);
$display("Payload sent to Scroeboard, waiting for next");
end
you are sending the payload to scoreboard only when CAFE pattern is seen? what about other parts of payload? I think better thing would be to send to scoreboard in logic of above point 1.