[SOLVED] Verilog - array and vector access

Status
Not open for further replies.

pbernardi

Full Member level 3
Joined
Nov 21, 2013
Messages
154
Helped
30
Reputation
60
Reaction score
31
Trophy points
1,308
Visit site
Activity points
2,962
Hello all,

I would like to access part of a vector, in a wire that is also an array. Is it possible somehow?

For example, the example below is not valid (I just make the code now by head, so sorry for any possible inconsistence):

Code:
wire [15:0] a[2:0];

genvar i;

for (i=0;i<8;i=i+1)
always @*
begin
  case (a[15:14][i])
  ...
  ...
  endcase
end

while this is valid

Code:
wire [15:0] a;

always @*
begin
  case (a[15:14])
  ...
  ...
  endcase
end

is there a way to address this? I know that I cannot access a slice of an array, but I want to access a slice of a vector that is also an array.
 

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