From 237b27e50b66a4ebe30bd94aadcd52c068b0ade8 Mon Sep 17 00:00:00 2001 From: gatecat Date: Fri, 23 Apr 2021 11:50:26 +0100 Subject: [PATCH] interchange: Add macro param map rules to chipdb Signed-off-by: gatecat --- fpga_interchange/chipdb.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/fpga_interchange/chipdb.h b/fpga_interchange/chipdb.h index 3565b534..155c2bb2 100644 --- a/fpga_interchange/chipdb.h +++ b/fpga_interchange/chipdb.h @@ -337,6 +337,28 @@ NPNR_PACKED_STRUCT(struct MacroParameterPOD { int32_t value; // constid }); +enum MacroParamRuleType +{ + PARAM_MAP_COPY = 0, // copy parameter value + PARAM_MAP_SLICE = 1, // take a slice of bits + PARAM_MAP_TABLE = 2, // lookup strings in table +}; + +NPNR_PACKED_STRUCT(struct MacroParamMapRulePOD { + // name of parameter on parent primitive + int32_t prim_param; // constid + // name of instance to set parameter on + int32_t inst_name; // constid + // name of parameter on macro expansion instance + int32_t inst_param; // constid + // type of mapping to use to derive new value + int32_t rule_type; // MacroParamRuleType + // for slice mappings, the bits to collect + RelSlice slice_bits; + // for table mappings, the lookup table to use + RelSlice map_table; +}); + NPNR_PACKED_STRUCT(struct MacroCellInstPOD { int32_t name; // instance name constid int32_t type; // instance type constid @@ -376,6 +398,8 @@ NPNR_PACKED_STRUCT(struct MacroExpansionPOD { int32_t macro_name; // list of parameters to (optionally) match RelSlice param_matches; + // how to derive parameters for expansion instances + RelSlice param_rules; }); NPNR_PACKED_STRUCT(struct ChipInfoPOD {