- #1
hoheiho
- 47
- 0
Homework Statement
Code:
logic [4:0]counter;
logic [WORD_W-1:0] mdr_rite_[COLOR="Red"][counter][/COLOR]; //range must be bounded by constant expressions
logic [WORD_W-OP_W-1:0] mar_rite_[COLOR="red"][COLOR="Red"][counter][/COLOR][/COLOR]; //range must be bounded by constant expressions
always_ff@(posedge clock, negedge n_reset)
begin
if (!n_reset)
begin
SE <= 0;
counter <=0;
end
else
if (check)
if (counter < 10)
begin
counter<=counter+1;
mar_rite_[counter] <= mar_check;
mdr_rite_[counter] <= mdr_check;
end
else
counter<=counter+1;
if (mar_rite_[counter]!=mar_check|mdr_rite_[counter]!=mdr_check)
SE<=SE+1;
end
endmodule
mar_check, mdr_check and check are the input. mar_rite, mdr_rite and counter are for internal use. And SE is the output.
If check = 1, counter will +1. When counter is 0 to 9, the mar_check and mdr_check will store in the mar_rite_[counter] and mdr_rite_[counter]. If the counter is 10 or above, it will compare the mdr and mar value. If they are not the same, SE+1.
It say the red colour part cannot be this kind of various. So I have to use another way to do this. I have try to use FSM but that is a bit long. Is there any hint for me to fix the errors?
I guess the same problem as http://www.edaboard.com/thread21319.html
But I am not quite understand how it does
Best regard