3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-16 05:48:44 +00:00
yosys/backends
Sahand Kashani 5157f5623e 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.
2020-08-06 00:49:55 +02:00
..
aiger Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
blif Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
btor Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
cxxrtl cxxrtl: fix typo. NFC. 2020-07-14 16:10:30 +00:00
edif Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
firrtl Add support for real-valued parameters + preserve type of parameters 2020-08-06 00:49:55 +02:00
ilang Use (and ignore) the expression provided to log_assert in NDEBUG builds. 2020-06-19 15:48:58 +00:00
intersynth Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
json Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
protobuf Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
simplec Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
smt2 smtio: Emit mode: start options before set-logic command and any other options after it. 2020-07-20 22:09:44 +00:00
smv Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
spice Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
table Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
verilog verilog_backend: in non-SV mode, add a trigger for always @*. 2020-07-16 11:30:14 +00:00