Go to the documentation of this file.
20 #include <coreir/ir/fwd_declare.h>
22 #include <unordered_map>
32 #define MOD_II(x) ((x) % II)
103 std::vector<Port*>
dst = {};
112 void add(std::vector<std::string> Data)
115 std::string ToAdd =
"";
116 for (
unsigned i = 0; i < Data.size(); i++)
117 ToAdd.append(Data[i]);
122 for (
unsigned i = 0; i <
ToPrint.size(); i++)
192 void addConnection(std::string src, std::string dst,
bool isInMRRG =
true);
201 void addPort(std::string portname,
port_type pt, std::string ParameterName,
unsigned size);
206 void addParameter(std::string parameterName,
unsigned parameterValue);
211 void genConfigOrder(std::vector<ConfigCell*> & ConfigTable)
const;
217 Port*
getPort(std::string full_port_name, std::string err_context =
"");
264 std::cout <<
getName() <<
'\n';
265 for (
const auto& op_and_nodes : mrrg_nodes_from_op_node) {
266 std::cout <<
'\t' << *op_and_nodes.first <<
'\n';
267 for (
const auto& mrrg_node : op_and_nodes.second) {
268 std::cout <<
"\t\t" << mrrg_node <<
'\n';
271 for (
const auto& val_and_nodes : mrrg_nodes_from_val_node) {
272 std::cout <<
'\t' << *val_and_nodes.first <<
'\n';
273 for (
const auto& mrrg_node : val_and_nodes.second) {
274 std::cout <<
"\t\t" << mrrg_node <<
'\n';
278 (void)mrrg_nodes_from_val_node;
293 void GetModulesToPrint(std::queue<Module*> & ToPrint, std::set<std::string> & PrintedModMap);
300 bool setNodePosition(
const std::string & nodeName,
double x,
double y);
301 std::pair<bool, std::pair<double, double>>
getSubModulePosition(
const std::string & submodName);
302 std::pair<bool, std::pair<double, double>>
getNodePosition(
const std::string & nodeName);
432 static const std::map<OpGraphOpCode, LLVMMode>
all_modes;
475 static const std::map<OpGraphOpCode, LLVMMode>
all_modes;
502 static const std::map<OpGraphOpCode, LLVMMode>
all_modes;
649 static const std::map<OpGraphOpCode,LLVMMode>
all_modes;
834 if (
connected_ports.size() < 1) {
throw cgrame_error(
"trying to get single connected port on ConfigCell with multiple (or zero) ports"); }
849 static const std::map<OpGraphOpCode,LLVMMode>
all_modes;
914 static const std::map<OpGraphOpCode, LLVMMode>
all_modes;
Module & operator=(const Module &)=delete
PipelineMode pipeline_mode
std::map< std::string, Module * > submodules
virtual std::string GenericName() override
const std::string & getName() const
void GenPortSpecs(bool HasConfig, bool HasRegisters)
virtual std::string GenericName() override
FracMulUnit(std::string name, Location loc, unsigned size, int II, int latency)
int FindPortIndex(std::string PortName)
std::map< Port *, Connection * > connections
DisconnectedSink(std::string name, Location, unsigned size)
virtual std::string GenericName() override
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
PipelineMode pipeline_mode
std::vector< OpGraphOpCode > supported_modes
virtual void GenFunctionality() override
virtual ~SelMultiplexer()
void GetConfigsToPrint(std::queue< ConfigCell * > &q, std::set< unsigned > &uniq)
ConstUnit(std::string name, Location, int size=DEFAULT_SIZE, int contexts=1, bool isElastic=false)
virtual nlohmann::json CoreIRGenFunctionality() override
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
PipelineMode(int II, int latency)
virtual std::string GenericName() override
Zero-cycle latency multiplexer.
ContextCounter(std::string name, int contexts, Location loc={0, 0})
virtual void GenFunctionality() override
For when an output is unused, but a connection is required anyway.
void genVerilogCGRAME(std::string dir)
std::vector< std::string > Function
UserModule(std::string prototype, std::string name, Location, std::vector< std::string > Ports)
virtual void GenModuleVerilog() override
const char *const SET_TRIPLE_INDENT
std::map< OpGraphOp *, std::set< MRRG::NodeDescriptor > > MRRGNodesFromOpNode
bool isSubModule(Module *)
virtual std::string GenericName() override
virtual std::string GenericName() override
void DetermineConnections(StringMatrix &Matrix, PrintList &WireList, PrintList &SubmodList, PrintList &AssignList)
virtual MRRG * createMRRG(unsigned II) override
ContextCell(std::string name, int contexts, Location loc={0, 0})
PipelineMode pipeline_mode
void add(std::vector< std::string > Data)
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
void addConnection(std::string src, std::string dst, bool isInMRRG=true)
const char *const SET_PENTA_INDENT
std::vector< std::string > Functionality
std::pair< bool, std::pair< double, double > > getSubModulePosition(const std::string &submodName)
virtual MRRG * createMRRG(unsigned II) override
SelMultiplexer(std::string, Location, unsigned mux_size, unsigned size=DEFAULT_SIZE, bool isElastic=false)
std::ostream & operator<<(std::ostream &os, VerilogType vt)
void addParameter(std::string parameterName, unsigned parameterValue)
bool adds_synchronous_circuitry
TriState(Mode mode, std::string, Location, unsigned size=DEFAULT_SIZE, bool isElastic=false)
const char *const SET_HEXA_INDENT
Module * getSubModule(std::string)
bool setNodePosition(const std::string &nodeName, double x, double y)
std::map< std::string, unsigned > parameterlist
virtual nlohmann::json CoreIRGenFunctionality() override
virtual nlohmann::json CoreIRGenFunctionality() override
A simple latency element with an enable signal; a data flip-flop.
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
const std::string & getName() const
virtual nlohmann::json CoreIRGenFunctionality() override
void addPort(std::string portname, port_type pt, unsigned size)
std::map< std::string, VisualPositionPoint > node_relative_position
int FindSubmoduleIndex(std::string SubmoduleName)
MRRG * createMRRG(unsigned II) override
static const std::map< OpGraphOpCode, LLVMMode > all_modes
FracUnit(std::string name, Location loc, std::vector< OpGraphOpCode > supported_modes, unsigned size, int II, int latency)
virtual std::string GenericName() override
virtual nlohmann::json CoreIRGenFunctionality() override
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const
void genVerilogCoreIR(std::string dir, int contexts)
MRRG * createMRRG(unsigned II) override
const std::vector< Port * > & getAllConnectedPorts() const
void GenModuleVerilog() override
const char *const PORT_DEFAULT_CONNECTION
Module & getModule() const
std::vector< std::string > ToPrint
virtual std::string GenericName() override
virtual MRRG * createMRRG(unsigned II) override
MRRG * createMRRG(unsigned II) override
PipelineMode pipeline_mode
RegisterFile(std::string name, Location, int numInputPorts, int numOutputPorts, int log2Registers, int size=DEFAULT_SIZE, int contexts=1, bool isElastic=false)
std::vector< Port * > connected_ports
virtual void GenFunctionality() override
virtual std::string GenericName() override
static const std::map< OpGraphOpCode, LLVMMode > all_modes
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
std::istream & operator>>(std::istream &is, port_type &porttype)
MRRG * createMRRG(unsigned II) override
std::vector< std::vector< std::string > > StringMatrix
std::map< OpGraphVal *, std::set< MRRG::NodeDescriptor > > MRRGNodesFromValNode
Module * getModuleFromPortName(std::string full_port_name, std::string err_context="")
virtual void GenConnections()
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
DeMux(std::string, Location, unsigned demux_size, unsigned size=DEFAULT_SIZE, bool isElastic=false)
bool hasConfigCells() const
virtual std::string GenericName() override
virtual nlohmann::json CoreIRGenFunctionality() override
virtual std::string GenericName()
std::map< std::string, ConfigCell * > configcells
virtual nlohmann::json CoreIRGenFunctionality() override
ConfigCell(std::string name, int contexts=1, Location loc={0, 0})
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
virtual nlohmann::json CoreIRGenFunctionality() override
virtual nlohmann::json CoreIRGenFunctionality() override
virtual void GenFunctionality() override
virtual ~DisconnectedSource()
virtual void GenFunctionality() override
CustomModule(std::string name, Location, std::vector< std::string > Function, unsigned size=DEFAULT_SIZE, std::string pred="")
void addElasticConnection(std::string src, std::string dst)
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
virtual std::string GenericName() override
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
virtual std::string GenericName() override
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
void GenModuleHeader(bool HasConfig, bool HasRegisters)
IO(std::string, Location, unsigned size=DEFAULT_SIZE, int contexts=1, bool isElastic=false)
Supports the input and output ops. Will add an external port at the top-level of generated verilog.
virtual std::string GenericName() override
virtual nlohmann::json CoreIRGenFunctionality()
virtual nlohmann::json CoreIRGenFunctionality() override
virtual void GenFunctionality() override
virtual MRRG * createMRRG(unsigned II) override
virtual void GenFunctionality() override
virtual std::string GenericName() override
const char *const SET_INDENT
static const std::vector< OpGraphOpCode > mul_modes_ordered
virtual void GenFunctionality() override
const bool MODULE_DEBUG_PRINTING
Module * getModule(std::string, std::string err_context="")
std::vector< Port > portsToPropagate
virtual std::string GenericName() override
void addVerilogPort(std::string name, port_type pt, std::string parameter, unsigned size)
virtual MRRG * createMRRG(unsigned II) override
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
virtual void CoreIRGenModuleVerilog(CoreIR::Context *c, int contexts)
static const std::map< OpGraphOpCode, LLVMMode > all_modes
virtual nlohmann::json CoreIRGenFunctionality() override
virtual ~DisconnectedSink()
std::vector< Port * > dst
static const std::map< OpGraphOpCode, LLVMMode > all_modes
virtual std::string GenericName() override
Register(std::string, Location, int size=DEFAULT_SIZE, bool isElastic=false)
void genConfigOrder(std::vector< ConfigCell * > &ConfigTable) const
void GetModulesToPrint(std::queue< Module * > &ToPrint, std::set< std::string > &PrintedModMap)
void addConfig(ConfigCell *c, std::vector< std::string > ConnectTo)
Port * getPort(std::string full_port_name, std::string err_context="")
CoreIR::ModuleDefGenFun makeCoreIRModuleDefinitonGenerator()
void addControledPorts(const std::vector< Port * > &new_ports)
static const std::map< OpGraphOpCode, LLVMMode > all_modes
void CoreIRGetModulesToPrint(std::queue< Module * > &ToPrint, std::set< std::string > &PrintedModMap)
MRRG * createMRRG(unsigned II) override
Compare(std::string name, Location, unsigned size, int II)
std::string ReturnPath() const
EventTransitionTable(std::string name, int contexts, Location loc={0, 0})
virtual nlohmann::json CoreIRGenFunctionality() override
virtual nlohmann::json CoreIRGenFunctionality() override
MRRG * createMRRG(unsigned II) override
void addElasticPort(std::string portname, port_type pt, unsigned size)
Crossbar(std::string name, Location, int num_inputs, int num_outputs, int data_size, bool predExist=false, int contexts=1)
MRRG * createMRRG(unsigned II) override
std::map< std::string, VisualPositionRect > submodule_relative_position
void addSubModule(Module *m)
PipelineMode & operator=(const PipelineMode &)=default
CaseStatement(std::string name, Location, unsigned numInputs, unsigned size, int latency, bool isElastic=false)
Single load & store memory operations.
Multiplexer(std::string, Location, unsigned mux_size, unsigned size=DEFAULT_SIZE, bool isElastic=false)
virtual std::string GenericName() override
const char *const SET_DOUBLE_INDENT
Module(std::string name, Location, unsigned size=DEFAULT_SIZE, bool isElastic=false)
std::map< std::string, Port * > ports
CoreIR::TypeGenFun makeCoreIRInterfaceGenerator()
virtual std::vector< ResolvedVeroligModuleParameter > ResolveVerilogParameters() const
static const std::vector< OpGraphOpCode > add_modes_ordered
bool addsSynchronousCircuitry() const
virtual std::string GenericName() override
virtual MRRG * createMRRG(unsigned contexts)
2 Zero-cycle latency multiplexers for predication support.
virtual nlohmann::json CoreIRGenFunctionality() override
virtual std::string GenericName() override
virtual void GenModuleVerilog()
FuncUnit(std::string name, Location, std::vector< OpGraphOpCode > supported_modes, unsigned size, int II, int latency, bool isElastic=false)
For when an input is unused, but a connection is required anyway.
unsigned int hierarchyLevel
auto & getSupportedModes() const
virtual std::string GenericName() override
Port & getSingleConnectedPort() const
virtual void CoreIRGenModuleVerilog(CoreIR::Context *, int) override
virtual void GenFunctionality() override
Zero-cycle latency DeMultiplexer.
virtual nlohmann::json CoreIRGenFunctionality() override
virtual nlohmann::json CoreIRGenFunctionality() override
std::vector< OpGraphOpCode > supported_modes
virtual std::string GenericName() override
std::vector< unsigned > contexts
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
MemoryUnit(std::string name, Location, unsigned size=DEFAULT_SIZE, bool isElastic=false, bool pred=false)
virtual void GenFunctionality() override
virtual std::string GenericName() override
void connectPorts(std::string src, std::string dst, bool isElastic)
virtual std::string GenericName() override
virtual nlohmann::json CoreIRGenFunctionality() override
std::pair< bool, std::pair< double, double > > getNodePosition(const std::string &nodeName)
Functional Unit, does one of a set of arithmetic computations.
virtual BitConfig getBitConfig(const MRRG &mrrg, const OpGraph &og, const Mapping &map, const ConfigCell &ccell, const MRRGNodesFromOpNode &mrrg_nodes_from_op_node, const MRRGNodesFromValNode &mrrg_nodes_from_val_node) const override
DisconnectedSource(std::string name, Location, unsigned size, int value=0)
std::string makeVerilogDeclaration() const
void GenerateMatrix(StringMatrix &Matrix)
virtual void GenFunctionality()
int getStorageSize() const
virtual std::string GenericName() override
FracAddUnit(std::string name, Location loc, unsigned size, int II, int latency)
auto & getSupportedModes() const
static const std::map< OpGraphOpCode, LLVMMode > all_modes
const char *const SET_QUAD_INDENT