Replies: 3 comments 17 replies
-
I'm very interested in this and willing to try implementing it for the PeakRDL exporters. Here are some thoughts about possible fixedpoint property implementations. Single PropertyThe available
The Q-format string wins on conciseness and readability. property fixedpoint {
type = string;
component = field | signal;
}; This would be used like field {
fixedpoint = "Q15";
} my_number[16]; The width can always be inferred from the field itself, but it would be nice to support the various forms:
Either Multiple PropertiesInstead of a single property, we could define one for signedness, one for fractional width, and one for the integer width. In this case it might look something like // "signed" is a reserved word
property signed_num {
type = bool;
component = field | signal;
// default false to match behavior of built-in boolean properties
default = false;
};
// number of fractional bits
property fracwidth {
type = longint unsigned;
component = field | signal;
};
// number of integer bits
property intwidth {
type = longint unsigned;
component = field | signal;
}; I actually like this quite a bit. It feels like more idiomatic SystemRDL and reduces the confusion from multiple interpretations of the Q-format. One limitation is that SystemRDL doesn't support signed integer types (!). But that can be worked around by requiring only one of the width properties to be defined ( Its usage would look like this: field {
signed_num;
fracwidth = 15;
} my_number[16] @jeras, what did you end up using? |
Beta Was this translation helpful? Give feedback.
-
I did not implement this yet, but my latest approach would be to not use UDPs and just have a parameterized https://github.com/jeras/PeakRDL-jinja/blob/devel_jinja_with_SystemRDL/example/vhdl_fixed.rdl https://github.com/jeras/PeakRDL-jinja/blob/devel_jinja_with_SystemRDL/example/vhdl_numeric.rdl |
Beta Was this translation helpful? Give feedback.
-
The following is the likely property declaration based on previous discussions: // signedness of a component
property is_signed {
type = bool;
component = field | signal;
default = true;
};
// number of fractional bits
property fracwidth {
type = longint unsigned;
component = field | signal;
};
// number of integer bits (including sign bit)
property intwidth {
type = longint unsigned;
component = field | signal;
}; As a first pass on the semantics for
For
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to define a user defined property for defining the next two bit vector types.
The question is what notation to use, I will list a few options, the provided examples are for the same type.
The property would be used in VHDL/Verilog and software header code generators.
Wikipedia provides a few notations, one of them looks a good fit.
I used the Q notation before (ARM version):
VHDL provides a standardized syntax for fixed point values:
And for arbitrary length integers there is:
Verilog/SystemVerilog does not provide a standardized syntax for fixed point values, but is is common to use this:
Arbitrary length integers are defined with the common vector notation and the signed/unsigned specifier (added in Verilog 2001):
Xilinx also provides type definitions for the C++ language based HLS:
I did not go in deep enough to find out whether there is a clear distinction between fixed point and arbitrary length integer.
The default choice for SystemRDL would be the Verilog notation, since a lot of the syntax is already based on Verilog.
The problem I see is, Verilog lacks a clear distinction between fixed point and arbitrary length integer.
VHDL provides the strongest standardization and the cleares distinction between types.
One option for Verilog syntax would be to just provide the
signed
/unsigned
specifier without a range for arbitrary length integer, withe the length of the vector extracted from the field width. And for fixed point use the full type with the range.Beta Was this translation helpful? Give feedback.
All reactions