mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
	
		
			352 B
		
	
	
	
		
			Verilog
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
	
		
			352 B
		
	
	
	
		
			Verilog
		
	
	
	
	
	
// 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
 |