0
\$\begingroup\$

I want to access elements (8 bits long) stored in an "array", then do a logic AND with some switches. So far, not working:

module top(SW, LED);
input [15:0] SW;
output [15:0] LED;
logic [4:0] q = {8'b11101000,
8'b10011000,
8'b10100010,
8'b10110110,
8'b10000101
};
assign LED[7:0] = q[0] & SW[7:0]; 
endmodule

I expect to have 8'b11101000 & SW[7:0] but clearly I'm not having that because of the result I'm seeing on the leds. How can I achieve this?

asked Apr 18, 2019 at 19:59
\$\endgroup\$
1
  • 1
    \$\begingroup\$ logic [7:0] q [4:0] = {...};, AFAIK. \$\endgroup\$ Commented Apr 18, 2019 at 20:07

1 Answer 1

1
\$\begingroup\$

You want

const logic [4:0] q[5] = {8'b11101000,
 8'b10011000,
 8'b10100010,
 8'b10110110,
 8'b10000101
};
answered Apr 18, 2019 at 20:34
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.