blob: 63ace307cf0f028090f225b08c3500bb033a9b52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// Demo for $anyconst
module demo5 (input clk);
wire [7:0] step_size = $anyconst;
reg [7:0] state = 0, count = 0;
reg [31:0] hash = 0;
always @(posedge clk) begin
count <= count + 1;
hash <= ((hash << 5) + hash) ^ state;
state <= state + step_size;
end
always @* begin
if (count == 42)
assert(hash == 32'h A18FAC0A);
end
endmodule
|