D
Daniel
Guest
I'm trying to understand and learn Verilog 2001 - so here are a few
questions on declaring variables and 'simply' adding a value to it.
Hope you can help me out in understanding these essential declarations
and operations:
//data is declared as
reg[127:0] data;
I need to write the code below in the always @(..) part.
//assign the variable data with a hex value
data <= {128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00};
data = 128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00;
//question: are the assignments correct?
//quesiton: what is the difference bewteen '<=' and '='
//add 1 bit to data
data <= {128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00};
data <= (data + 1);
//does data become 00FFFFFFFFFFFFFFFFFFFFFFFFFF01
//add 1 bit to MSB or LSB (?) of data
data[8:0] <= data[8:0] + 1'b1;
//does data become 00FFFFFFFFFFFFFFFFFFFFFFFFFF01 or
//does data become 01FFFFFFFFFFFFFFFFFFFFFFFFFF00
//add 1 bit to data
data = {128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00};
data[127:0] <= data[127:0] + 1'b1;
//data becomes 00FFFFFFFFFFFFFFFFFFFFFFFFFF01 ?
//add 1 bit to data (overflow?)
data = {128 'h FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF};
data[127:0] <= data[127:0] + 1'b1;
//data becomes 0
//data becomes 01000000000000000000000000000000 ?
Hope you can help me out. Thanks!
questions on declaring variables and 'simply' adding a value to it.
Hope you can help me out in understanding these essential declarations
and operations:
//data is declared as
reg[127:0] data;
I need to write the code below in the always @(..) part.
//assign the variable data with a hex value
data <= {128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00};
data = 128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00;
//question: are the assignments correct?
//quesiton: what is the difference bewteen '<=' and '='
//add 1 bit to data
data <= {128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00};
data <= (data + 1);
//does data become 00FFFFFFFFFFFFFFFFFFFFFFFFFF01
//add 1 bit to MSB or LSB (?) of data
data[8:0] <= data[8:0] + 1'b1;
//does data become 00FFFFFFFFFFFFFFFFFFFFFFFFFF01 or
//does data become 01FFFFFFFFFFFFFFFFFFFFFFFFFF00
//add 1 bit to data
data = {128 'h 00FFFFFFFFFFFFFFFFFFFFFFFFFF00};
data[127:0] <= data[127:0] + 1'b1;
//data becomes 00FFFFFFFFFFFFFFFFFFFFFFFFFF01 ?
//add 1 bit to data (overflow?)
data = {128 'h FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF};
data[127:0] <= data[127:0] + 1'b1;
//data becomes 0
//data becomes 01000000000000000000000000000000 ?
Hope you can help me out. Thanks!