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

[enhancement] Add parameter with initial values for RamModel #1981

Open
rw1nkler opened this issue Mar 6, 2025 · 1 comment
Open

[enhancement] Add parameter with initial values for RamModel #1981

rw1nkler opened this issue Mar 6, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@rw1nkler
Copy link
Contributor

rw1nkler commented Mar 6, 2025

What's hard to do? (limit 100 words)

It is impossible to initialize RamModel with a given values. The need for this functionality was expressed as a TODO left in the code. Now, it should be possible to extend the module with an additional parameter

Current best alternative workaround (limit 100 words)

Fill the RAM directly in the DSLX test

Your view of the "best case XLS enhancement" (limit 100 words)

Add a parameter that accepts an array of initial values for RamModel to simplify RAM usage in tests

@rw1nkler rw1nkler added the enhancement New feature or request label Mar 6, 2025
@rw1nkler
Copy link
Contributor Author

rw1nkler commented Mar 6, 2025

I thought that adding this should be possible now, but it seems that more advanced parameter evaluation is required to express the type of the parameter with initial values. When I tried to add such a parameter in the following way:

pub proc RamModel<
    DATA_WIDTH:u32, SIZE:u32,
    WORD_PARTITION_SIZE:u32={u32:0},
    ...
    ADDR_WIDTH:u32 = {std::clog2(SIZE)},
    NUM_PARTITIONS:u32={num_partitions(WORD_PARTITION_SIZE, DATA_WIDTH)},
    INIT_VALUE: uN[DATA_WIDTH][SIZE] = { uN[DATA_WIDTH][SIZE]:[uN[DATA_WIDTH]:0, ...] }                                          
> { ... }

I received a type error:

0195: pub proc RamModel<DATA_WIDTH:u32, SIZE:u32, INIT_VALUE: uN[DATA_WIDTH][SIZE],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^--------^ TypeMissingError: node: 0x559f5833d820 user: 0x559f5833ff90 internal error: AST node is missing a corresponding type: DATA_WIDTH 0x559f5833d820 (kind: NameDef) defined @ xls/examples/ram.x:195:19-195:29. This may be due to recursion, which is n
ot supported.
0196:   WORD_PARTITION_SIZE:u32={u32:0},
0197:   SIMULTANEOUS_READ_WRITE_BEHAVIOR:SimultaneousReadWriteBehavior=

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

1 participant