From 4ecd8b98d1e8d43429ea8bc18edf8aa606a35ec4 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 19 Mar 2021 15:52:00 -0700 Subject: Add entries for default parameters, and how to present parameters as strings. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- interchange/DeviceResources.capnp | 46 +++++++++++++++++++++++++++++++++++++++ interchange/LogicalNetlist.capnp | 33 +++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/interchange/DeviceResources.capnp b/interchange/DeviceResources.capnp index 17cc3f1..9540f3f 100644 --- a/interchange/DeviceResources.capnp +++ b/interchange/DeviceResources.capnp @@ -85,6 +85,7 @@ struct Device { constants @12 : Constants; constraints @13 : Constraints; lutDefinitions @14 : LutDefinitions; + parameterDefs @15 : ParameterDefinitions; ####################################### # Placement definition objects @@ -590,4 +591,49 @@ struct Device { # Which sites have LUT BELs? lutElements @1 : List(LutElements); } + + enum ParameterFormat { + string @0; + # TRUE/FALSE/1/0 + boolean @1; + # 0/1/256 + integer @2; + # 0.0 + floatingPoint @3; + # 1'b0 + verilogBinary @4; + # 8'hF + verilogHex @5; + # 0xF + cBinary @6; + # 0.0 + cHex @7; + } + + struct ParameterDefinition { + # What is the name of this parameter? + name @0 : StringIdx; + + # When a parameter is stored as a string, what presentation should it use? + # + # If the default is stored as a string, it must be in this presentation. + # If a logical netlist stores this parameter as a string, it must be in + # this presentation. + format @1 : ParameterFormat; + + # Default parameter value + # + # Note: key should also be set for ease of copy into + # LogicalNetlist. + default @2 : Dir.Netlist.PropertyMap.Entry; + } + + struct CellParameterDefinition { + cellType @0 : StringIdx; + parameters @1 : List(ParameterDefinition); + } + + struct ParameterDefinitions { + cells @0 : List(CellParameterDefinition); + } } diff --git a/interchange/LogicalNetlist.capnp b/interchange/LogicalNetlist.capnp index d61a660..eba0feb 100644 --- a/interchange/LogicalNetlist.capnp +++ b/interchange/LogicalNetlist.capnp @@ -129,14 +129,41 @@ struct Netlist { } } + # Arbitrary length bitstring, encoded into array of uint8. + # + # width is the width of the bitstring in number of bits. + # Data is required to ceil(width/8) elements long. + # Bits are stored in LSB order. Example. + # + # If bits is a bool vector-like, then: + # + # bits[0] is storage in the LSB of data[0]. + # bits[8] is storage in the LSB of data[1]. + # + # e.g. bit[0] === (data[0] & (1 << 0)) != 0 + # e.g. bit[1] === (data[0] & (1 << 1)) != 0 + # e.g. bit[7] === (data[0] & (1 << 7)) != 0 + # e.g. bit[8] === (data[1] & (1 << 0)) != 0 + # + struct Bitstring { + width @0 : UInt32; + data @1 : List(UInt8); + } + struct PropertyMap { entries @0 : List(Entry); struct Entry { key @0 : StringIdx $stringRef(); + # Some tools may require a particular presentation. textValue is the + # most general, and should always be accepted. + # + # See DeviceResources.ParameterDefinition for potential string + # presentations. union { - textValue @1 : StringIdx $stringRef(); - intValue @2 : Int32; - boolValue @3 : Bool; + textValue @1 : StringIdx $stringRef(); + intValue @2 : Int32; + boolValue @3 : Bool; + bitstringValue @4 : Bitstring; } } } -- cgit v1.2.3