I must have missed that day in class. Sometimes (often?) when I look at example verilog code, I'll see statements like shown in the code snip below. My understanding (through reading and in practice) is that all of these samples show valid ways to set the registers to 0 or in the case of test2, to 5, and the difference is in readability (or to get a point across considering the vector). Am I wrong?
reg test1;
reg [3:0] test2;
// set to 0
test1 <= 0;
test2 <= 2'b00;
test2 <= 0;
// set to 5
test2 <= 4'b0101;
test2 <= 4'h5;
test2 <= 5;
Question
engrpetero
I must have missed that day in class. Sometimes (often?) when I look at example verilog code, I'll see statements like shown in the code snip below. My understanding (through reading and in practice) is that all of these samples show valid ways to set the registers to 0 or in the case of test2, to 5, and the difference is in readability (or to get a point across considering the vector). Am I wrong?
reg test1; reg [3:0] test2; // set to 0 test1 <= 0; test2 <= 2'b00; test2 <= 0; // set to 5 test2 <= 4'b0101; test2 <= 4'h5; test2 <= 5;
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now