HELP: Bit-select on array element??? 
Author Message
 HELP: Bit-select on array element???


> I have declared an array of regs like this:
>     reg [31:0] table[0:15];

> When I try to do a bit-select on an element of the array like this:
>     table[0][0] = 1;

> it complains about the second '['.

> Am I mistaken about how to do bit-selects on arrays?  CAN you do bit-selects
> on arrays?  Is there a simple solution to the problem?

> Thanks.

  You can't select bits in an array, directly. You have to use an intermediate

  reg [7:0] mem_array [0:7];     // 8x8 RAM
  reg [7:0] temp_mem_data;
  reg [2:0] mem_address;
  reg [2:0] some_other_signal;

    $readmemb ("", test_bench.mem_array, 0, 7); // maybe better
    temp_mem_data [7:0] = mem_array [mem_address];
    some_other_signal [2:0] = temp_mem_data [6:4];

  This is the simplest and fastest way to access bit-select.


Tue, 05 Jun 2001 03:00:00 GMT  
 [ 4 post ] 

 Relevant Pages 

1. (typep (make-array 10 :element-type 'bit) '(array bit (10)))

2. selecting array elements with a logical array

3. Shifting array element & regex on array element

4. print select elements from array

5. Array selecting elements

6. Selecting elements of an array using property nodes

7. How to select array elements?

8. Arrays: Build array in multiple for loops or replace array elements

9. Adding an element in an array of cluster of 2 elements

10. Help in match with array element

11. need help on pattern matching with array elements

12. Help assigning elements to a 1d array


Powered by phpBB® Forum Software