Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id_queue: Add support for multidimensional arrays #145

Open
niwis opened this issue Aug 9, 2022 · 1 comment
Open

id_queue: Add support for multidimensional arrays #145

niwis opened this issue Aug 9, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@niwis
Copy link
Collaborator

niwis commented Aug 9, 2022

As noted in #138, id_queue currently does not support multidimensional arrays:

On line 369, we loop over all bits in data_t, which only works for 1D vectors or packed structs

There are several options to address this:

  • Add an assertion or comment to disallow multidimensional arrays as data_t. These would need to be flattened outside the module.
  • Use a width parameter instead of a type parameter for data_t (as suggested in Fix toolproblems in id_queue #138)
  • Flatten within id_queue
@niwis niwis added the enhancement New feature or request label Aug 9, 2022
@nyaoaki
Copy link

nyaoaki commented Dec 10, 2022

Allow me to leave a comment that might help with what this issue discusses.

I encountered synthesis errors regarding exists_match_bits.
The synthesis tool interpreted that exists_match_bits is multiply assigned and forming combinational loops.
This is probably because the inner genvar loop means to clone a logic of assigning to single exists_match_bits, rather than an assignment to each bit of exists_match_bits.

Considering the code would intend, I worked for a resolution as follows.
The errors have been resolved.

     // Exists Lookup
     for (genvar i = 0; i < CAPACITY; i++) begin: gen_lookup
         data_t exists_match_bits;
-        for (genvar j = 0; j < $bits(data_t); j++) begin: gen_mask
-            always_comb begin
+        always_comb begin
+            for (int j = 0; j < $bits(data_t); j++) begin: gen_mask
                 if (linked_data_q[i].free) begin
                     exists_match_bits[j] = 1'b0;
                 end else begin
                    if (!exists_mask_i[j]) begin
                        exists_match_bits[j] = 1'b1;
                    end else begin
                        exists_match_bits[j] = (linked_data_q[i].data[j] == exists_data_i[j]);
                    end
                end
            end
        end
        assign exists_match[i] = (&exists_match_bits);
    end

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants