Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Input matrix in verilog

Status
Not open for further replies.

akipro

Newbie level 6
Newbie level 6
Joined
Mar 14, 2013
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,361
Hey, I want to input a n*m (n and m are defined) matrix in verilog (where each element is of 32 bit length), but the compiler gives an error. Is there any direct way to do so? I don't want to write n*m separate input elements.

This is what I tried:

Code:
 input reg [31:0] matrix [0:9][0:12]

Anything wrong here?

Thanks
 
Last edited by a moderator:

Verilog doesn't support arrays in the module port declaration. You'll need to concatenate the busses together.

Input [10*13*32-1:0] matrix

In the body of your code you can include a for loop to extact slices and assign them to a wire array.

reg cannot be used as the type for an input.

Regars
 

Can I use verilog code in system verilog, it seems we can use 2D matrix as input in system verilog?
 

I'm not sure as I mostly use Verilog. I can't check as I don't have the IEEE spec handy. You can download it for free on IEEE's we site.
 

Verilog is now a subset of SystemVerilog.
At least in SystemVerilog, you can:
PHP:
input reg [0:9][0:12][31:0] matrix ;

This will give you a 10*13 matrix, in which each element is 32 bit register.
if you define it as row=10, column=13, then matrix[2][3] means the element at row[2] and column[3].
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top