Direct assignment to matrix in Verilog.

Status
Not open for further replies.

ismailov-e

Member level 1
Joined
Jan 26, 2015
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
295
Hi everybody!
Can we assign matrix directly like in C language.
For example:

Code Verilog - [expand]
1
2
3
reg [7:0] matrix [4:0][4:0];
 
matrix = {12345,54321,23432,55533,22212};


or

Code Verilog - [expand]
1
matrix = {{1,2,3,4,5},{5,4,3,2,1},{2,3,4,3,2},{5,5,5,3,3},{2,2,2,1,2}};



- - - Updated - - -

After Synthesis the message come: "[Synth 8-1725] cannot assign to memory matrix directly"
"[Synth 8-2833] unpacked value/target cannot be used in assignment"
 



you need to refer to this thread (link below) in the edaboard forum. Check the link where a guy has asked similar question like you.

https://www.edaboard.com/threads/339582/
 



The OP is asking for help with Verilog - not VHDL. DOnt answer a verilog request with VHDL examples - they are not going to help.

To the OP - try putting ' infront of the arrays:

matrix = '{ '{1,2,3,4,5}, '{5,4,3,2,1}, '{2,3,4,3,2}, '{5,5,5,3,3}, '{2,2,2,1,2}};
 


Thanks for your reply.
Is this syntax in System Verilog?
I have an error in Verilog.
 

To use C-like array assignments, you need to be using SystemVerilog.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…