2 dimensional module inputs.

B

Brian Guralnick

Guest
This is the first time I'm attempting a 2 dimensional input:

input [ADDR_SIZE:0] addr_in [2:0];

Now, in the past, I've used registers like this without problem, but, my
compiler wont accept this as an input.

How is it done?

_____________
Brian Guralnick
 
"Brian Guralnick" <vergent.tech@sympatico.ca> wrote in message
news:cYXDc.5839$207.499932@news20.bellglobal.com...
This is the first time I'm attempting a 2 dimensional input:

input [ADDR_SIZE:0] addr_in [2:0];

Now, in the past, I've used registers like this without problem, but, my
compiler wont accept this as an input.

How is it done?

It's done by changing the input to a 1 dimensional vector with 2d-1d and
1d-2d mappings in the upper and lower modules, respectively.

input [ADDR_SIZE*3+2:0] addr_in_arr;
reg [ADDR_SIZE:0] addr_in [2:0];
integer i;
always @(*)
for( i=0; i<=ADDR_SIZE; i=i+1)
addr_in = addr_in_arr >> 3*i;
 
Damn, I should have noticed that 1. It's simple and obvious. I guess
working in Quartus got me used to having multiple braces after a variable to
accommodate any number of dimensions.

Thx...
_____________
Brian Guralnick


"John_H" <johnhandwork@mail.com> wrote in message
news:2pYDc.4$E51.949@news-west.eli.net...
"Brian Guralnick" <vergent.tech@sympatico.ca> wrote in message
news:cYXDc.5839$207.499932@news20.bellglobal.com...
This is the first time I'm attempting a 2 dimensional input:

input [ADDR_SIZE:0] addr_in [2:0];

Now, in the past, I've used registers like this without problem, but, my
compiler wont accept this as an input.

How is it done?

It's done by changing the input to a 1 dimensional vector with 2d-1d and
1d-2d mappings in the upper and lower modules, respectively.

input [ADDR_SIZE*3+2:0] addr_in_arr;
reg [ADDR_SIZE:0] addr_in [2:0];
integer i;
always @(*)
for( i=0; i<=ADDR_SIZE; i=i+1)
addr_in = addr_in_arr >> 3*i;
 

Welcome to EDABoard.com

Sponsor

Back
Top