diff options
author | Sahand Kashani <sahand.kashani@gmail.com> | 2020-08-06 00:49:55 +0200 |
---|---|---|
committer | Sahand Kashani <sahand.kashani@gmail.com> | 2020-08-06 00:49:55 +0200 |
commit | 5157f5623e2795c6ec2da650a7d8b5587af50c78 (patch) | |
tree | 3c6b18270dfb58353bd13f8f09106bf532a603c8 /passes | |
parent | 2c6cc27af1e981d24342ad1b378ec0f6d93092f1 (diff) | |
download | yosys-5157f5623e2795c6ec2da650a7d8b5587af50c78.tar.gz yosys-5157f5623e2795c6ec2da650a7d8b5587af50c78.tar.bz2 yosys-5157f5623e2795c6ec2da650a7d8b5587af50c78.zip |
Add support for real-valued parameters + preserve type of parameters
This commit adds support for real-valued parameters in blackboxes. Additionally,
parameters now retain their types are no longer all encoded as strings.
There is a caveat with this implementation due to my limited knowledge of yosys,
more specifically to how yosys encodes bitwidths of parameter values. The example
below can motivate the implementation choice I took. Suppose a verilog component
is declared with the following parameters:
parameter signed [26:0] test_signed;
parameter [26:0] test_unsigned;
parameter signed [40:0] test_signed_large;
If you instantiate it as follows:
defparam <inst_name> .test_signed = 49;
defparam <inst_name> .test_unsigned = 40'd35;
defparam <inst_name> .test_signed_large = 40'd12;
If you peek in the RTLIL::Const structure corresponding to these params, you
realize that parameter "test_signed" is being considered as a 32-bit value
since it's declared as "49" without a width specifier, even though the parameter
is defined to have a maximum width of 27 bits.
A similar issue occurs for parameter "test_unsigned" where it is supposed to take
a maximum bit width of 27 bits, but if the user supplies a 40-bit value as above,
then yosys considers the value to be 40 bits.
I suppose this is due to the type being defined by the RHS rather than the definition.
Regardless of this, I emit the same widths as what the user specifies on the RHS when
generating firrtl IR.
Diffstat (limited to 'passes')
0 files changed, 0 insertions, 0 deletions