summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-04-23 11:37:13 +0100
committergatecat <gatecat@ds0.me>2021-05-12 11:02:22 +0100
commit0b935e4679c95b4fcb9b95fa8492a922b18e2c70 (patch)
tree8b524355a00bff53ae5bf64118e05c63bd1d8df7
parent596bccc6e57c6c57df1d99d4af300d6a2e722ed9 (diff)
downloadfpga-interchange-schema-0b935e4679c95b4fcb9b95fa8492a922b18e2c70.tar.gz
fpga-interchange-schema-0b935e4679c95b4fcb9b95fa8492a922b18e2c70.tar.bz2
fpga-interchange-schema-0b935e4679c95b4fcb9b95fa8492a922b18e2c70.zip
Add parameter mapping rules for macros
Signed-off-by: gatecat <gatecat@ds0.me>
-rw-r--r--interchange/DeviceResources.capnp42
1 files changed, 41 insertions, 1 deletions
diff --git a/interchange/DeviceResources.capnp b/interchange/DeviceResources.capnp
index 465e212..44313b8 100644
--- a/interchange/DeviceResources.capnp
+++ b/interchange/DeviceResources.capnp
@@ -234,10 +234,45 @@ struct Device {
constant @1 : ConstantType;
}
+ # Table lookup map, for string parameters
+ struct ParameterMapEntry {
+ # If the primitive parameter matches 'from', then the macro
+ # instance parameter will be set to 'to'.
+ from @0 : StringIdx $stringRef();
+ to @1 : StringIdx $stringRef();
+ }
+
+ # This describes how we map a parameter from primitive to its
+ # macro expansion.
+ struct ParameterMapRule {
+ # Name of the parameter in its parent primitive
+ primParam @0 : StringIdx $stringRef();
+ # Name of the cell instance to set the derived parameter on
+ instName @1 : StringIdx $stringRef();
+ # Name of the parameter on the cell instance to set
+ instParam @2 : StringIdx $stringRef();
+ # How to derive the new parameter value
+ union {
+ # Copy the value directly across with no transform applied
+ copyValue @3 : Void;
+ # Apply an arbitrary mapping of bits while deriving the new value.
+ # Bit i of the derived value will be taken from bit bitSlice[i] of the
+ # parent primitive parameter. This way bit ranges; every Nth bit and
+ # permutation can all be represented.
+ bitSlice @4 : List(UInt32);
+ # Use a table lookup to derive a new value for a string parameter.
+ tableLookup @5 : List(ParameterMapEntry);
+ }
+ }
+
######################################
# Macro expansion exception map for
# primitives that don't expand to a
- # macro of the same name.
+ # macro of the same name. This is also
+ # used for conditional matches on
+ # parameter values and parameter
+ # transforms from primitive to
+ # expansion.
######################################
struct PrimToMacroExpansion {
primName @0 : StringIdx $stringRef();
@@ -250,6 +285,11 @@ struct Device {
always @2 : Void;
parameters @3 : List(Dir.Netlist.PropertyMap.Entry);
}
+ # These rules are used to map parameters from the primitive to the
+ # constituent cell instances for the macro. For example; a LUTRAM
+ # primitive might have its init value split up to the init values
+ # of its constituent LUTs.
+ paramMapping @4 : List(ParameterMapRule);
}
# Cell <-> BEL and Cell pin <-> BEL Pin mapping