Skip to content

Instantly share code, notes, and snippets.

@tejainece
Created January 29, 2014 18:22
Show Gist options
  • Save tejainece/8693815 to your computer and use it in GitHub Desktop.
Save tejainece/8693815 to your computer and use it in GitHub Desktop.
Where not to assign wire and reg in Verilog. This was written for demonstration purposes in my blog post.
module RegAssignmentWrong(
output reg o,
input in1,
input in2
);
assign o = in1 & in2;
endmodule
module WireAssignmentWrong(
output o1,
input in1,
input in2
);
always @(in1, in2) begin
o1 <= in1 & in2;
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment