FABulous.fabric_generator.parser.parse_hdl¶
Contains functions for processing BEL related information from HDL files.
Classes¶
Functions¶
- belMapProcessing(module_info)[source]¶
- Parameters:
module_info (YosysModule)
- Return type:
Extract and transform BEL mapping attributes in YosysModule.
- param module_info:
A dictionary containing the module’s attributes, including potential BEL mapping information.
- type module_info:
YosysModule
- returns:
Dictionary containing the parsed bel mapping information.
- rtype:
dict
- raises ValueError:
If any BEL mapping attribute has an invalid format or index.
Parse a Verilog or VHDL BEL file and return related information of the BEL.
The function will also parse and record all the FABulous attributes which all start with:
(* FABulous, <type>, … *)
The <type> can be one the following:
BelMap
EXTERNAL
SHARED_PORT
GLOBAL
CONFIG_PORT
SHARED_ENABLE
SHARED_RESET
The BelMap attribute will specify the bel mapping for the bel. This attribute should be placed before the start of the module. The bel mapping is then used for generating the bitstream specification. Each of the entry in the attribute will have the following format:
<name> = <value>
<name>is the name of the feature and<value>will be the bit position of the feature. ie.INIT=0will specify that the featureINITis located at bit 0. Since a single feature can be mapped to multiple bits, this is currently done by specifying multiple entries for the same feature. This will be changed in the future. The bit specification is done in the following way:INIT_a_1=1, INIT_a_2=2, ...The name of the feature will be converted to
INIT_a[1],INIT_a[2]for the above example. This is necessary because Verilog does not allow square brackets as part of the attribute name.EXTERNAL attribute will notify FABulous to put the pin in the top module during the fabric generation.
SHARED_PORT attribute will notify FABulous this the pin is shared between multiple bels. Attribute need to go with the EXTERNAL attribute.
GLOBAL attribute will notify FABulous to stop parsing any pin after this attribute.
CONFIG_PORT attribute will notify FABulous the port is for configuration.
Example
Verilog
(* FABulous, BelMap, single_bit_feature=0, //single bit feature, single_bit_feature=0 multiple_bits_0=1, //multiple bit feature bit0, multiple_bits[0]=1 multiple_bits_1=2 //multiple bit feature bit1, multiple_bits[1]=2 *) module exampleModule (
externalPin, normalPin1, normalPin2, sharedPin, globalPin); (* FABulous, EXTERNAL ) input externalPin; input normalPin; ( FABulous, EXTERNAL, SHARED_PORT ) input sharedPin; ( FABulous, GLOBAL) input globalPin; output normalPin2; //do not get parsed …
- param filename:
The filename of the bel file.
- type filename:
Path
- param belPrefix:
The bel prefix provided by the CSV file. Defaults to “”.
- type belPrefix:
str, optional
- returns:
A Bel object containing all the parsed information.
- rtype:
Bel
- raises FabricParsingError:
Fabric cannot be parsed
- raises InvalidBelDefinition:
The BEL file contains invalid BEL definitions. Such as wrong attribute type on wrong port type. i.e SHARE_EN on output ports
- raises ValueError:
Port naming is reused