@@ -234,10 +234,45 @@ struct Device {
234
234
constant @1 : ConstantType;
235
235
}
236
236
237
+ # Table lookup map, for string parameters
238
+ struct ParameterMapEntry {
239
+ # If the primitive parameter matches 'from', then the macro
240
+ # instance parameter will be set to 'to'.
241
+ from @0 : StringIdx $stringRef();
242
+ to @1 : StringIdx $stringRef();
243
+ }
244
+
245
+ # This describes how we map a parameter from primitive to its
246
+ # macro expansion.
247
+ struct ParameterMapRule {
248
+ # Name of the parameter in its parent primitive
249
+ primParam @0 : StringIdx $stringRef();
250
+ # Name of the cell instance to set the derived parameter on
251
+ instName @1 : StringIdx $stringRef();
252
+ # Name of the parameter on the cell instance to set
253
+ instParam @2 : StringIdx $stringRef();
254
+ # How to derive the new parameter value
255
+ union {
256
+ # Copy the value directly across with no transform applied
257
+ copyValue @3 : Void;
258
+ # Apply an arbitrary mapping of bits while deriving the new value.
259
+ # Bit i of the derived value will be taken from bit bitSlice[i] of the
260
+ # parent primitive parameter. This way bit ranges; every Nth bit and
261
+ # permutation can all be represented.
262
+ bitSlice @4 : List(UInt32);
263
+ # Use a table lookup to derive a new value for a string parameter.
264
+ tableLookup @5 : List(ParameterMapEntry);
265
+ }
266
+ }
267
+
237
268
# #####################################
238
269
# Macro expansion exception map for
239
270
# primitives that don't expand to a
240
- # macro of the same name.
271
+ # macro of the same name. This is also
272
+ # used for conditional matches on
273
+ # parameter values and parameter
274
+ # transforms from primitive to
275
+ # expansion.
241
276
# #####################################
242
277
struct PrimToMacroExpansion {
243
278
primName @0 : StringIdx $stringRef();
@@ -250,6 +285,11 @@ struct Device {
250
285
always @2 : Void;
251
286
parameters @3 : List(Dir.Netlist.PropertyMap.Entry);
252
287
}
288
+ # These rules are used to map parameters from the primitive to the
289
+ # constituent cell instances for the macro. For example; a LUTRAM
290
+ # primitive might have its init value split up to the init values
291
+ # of its constituent LUTs.
292
+ paramMapping @4 : List(ParameterMapRule);
253
293
}
254
294
255
295
# Cell <-> BEL and Cell pin <-> BEL Pin mapping
0 commit comments