How can we read and write values in a multidimensional array in verilog, i had read in this link regarding different operations that can be done on multidimensional array.
like if there is a part of code like this
input [15:0] me;
reg [15:0] p_array [7:0];
reg abc_pqr [2:0];
abc_pqr[0] <= me[0];
abc_pqr[1] <= me[1];
abc_pqr[2] <= me[1];
p_array[abc_pqr[0]] <= me[0];
p_array[abc_pqr[1]] <= me[1];
p_array[abc_pqr[2]] <= me[2];
so is this code will work and will not produce any error?
What is the difference between these two while assigning value
"<=" and "=", i had seen "<=" in most of the places during passing values.
Best Answer
This is not one question but breaking down the main points:
<=
is a non-blocking assignment used when implying a flip-flop output.=
is a blocking assignment used when implementing combinatorial output.example usage:
You defined 3 different data types:
me
is a standard 16 bit word.p_array
is an 8 deep memory of 16 bit words.NB: it is typical to define as reg [15:0] p_array [0:7];
abc_pqr [2:0];
is a 3 deep 1bit memory.You have :
Looks valid.
Then :
p_array needs a
[7:0]
wide index, you have only supplied 1 bit. and a p_array element is 16 bits wide your left hand side is again only 1 bit.