N-bit register with asynchronous reset
module regN (Q, reset, CLK, D);
input reset;
input CLK;
parameter N = 8; // Allow N to be changed
input [N-1:0] D;
output [N-1:0] Q;
reg [N-1:0] Q;
always @(posedge CLK or posedge reset)
if (reset)
Q = 0;
else if (CLK == 1)
Q = D;
endmodule // regN
Parameters are constants
? Not variables
? Parameter values are inserted at compile time
Previous slide
Next slide
Back to first slide
View graphic version