18 const int invalidDataflowID = -1;
22 using channelID = int;
27 using vecFuncs = std::vector<funcID>;
28 using setFuncs = std::set<funcID>;
29 using listFuncs = std::list<funcID>;
30 using vecBlocks = std::vector<blockID>;
31 using setBlocks = std::set<blockID>;
32 using listBlocks = std::list<blockID>;
33 using vecPorts = std::vector<portID>;
34 using setPorts = std::set<portID>;
35 using listPorts = std::list<portID>;
36 using vecChannels = std::vector<channelID>;
37 using setChannels = std::set<channelID>;
38 using listChannels = std::list<channelID>;
43 enum BlockType {OPERATOR,
68 enum PortType {GENERIC_PORT,
75 enum PortDirection {INPUT_PORTS,
119 DFnetlist(
const std::string& name,
const std::string& name_bb);
142 const std::string&
getName()
const;
150 blockID
createBlock(BlockType type,
const std::string& name =
"");
157 blockID
getBlock(
const std::string& name)
const;
180 double getBlockRetimingDiff(blockID
id)
const;
182 void setBlockRetimingDiff(blockID
id,
double retimingDiff);
234 double getTrueFrac(blockID
id)
const;
286 portID
createPort(blockID block,
bool isInput,
const std::string& name=
"",
int width = -1, PortType type = GENERIC_PORT);
300 portID
getPort(blockID block,
const std::string& name)
const;
308 const std::string&
getPortName(portID port,
bool full=
true)
const;
372 const setPorts&
getPorts(blockID
id, PortDirection dir)
const;
519 void setChannelFrequency(channelID
id,
double value);
521 double getChannelFrequency(channelID
id);
538 blockID
insertBuffer(channelID c,
int slots,
bool transparent);
549 blockID
insertBuffer(channelID c,
int slots,
bool transparent,
bool EB);
561 void setError(
const std::string& err);
566 const std::string&
getError()
const;
625 bool writeDot(
const std::string& filename =
"");
634 bool writeDotMG(
const std::string& filename =
"");
635 bool writeDotMG(std::ostream& s);
637 bool writeDotBB(std::ostream& s);
638 bool writeDotBB(
const std::string& filename =
"");
663 bool addElasticBuffers(
double Period = 0,
double BufferDelay = 0,
bool maxThroughput =
false,
double coverage = 0);
665 bool addElasticBuffersBB(
double Period = 0,
double BufferDelay = 0,
bool maxThroughput =
false,
double coverage = 0,
int timeout = -1,
bool first_MG =
false);
667 bool addElasticBuffersBB_sc(
double Period = 0,
double BufferDelay = 0,
bool maxThroughput =
false,
double coverage = 0,
int timeout = -1,
bool first_MG =
false,
const std::string& model_mode =
"default",
const std::string& lib_path=
"");
696 void computeSCC(
bool onlyMarked);
698 void printBlockSCCs();
748 DFlib(
const std::string& name);
756 bool add(
const std::string& filename);
764 bool writeDot(
const std::string& filename =
"");
770 void setError(
const std::string& err);
775 const std::string&
getError()
const;
791 int numFuncs()
const;
798 funcID getFuncID(
const std::string& fname)
const;
805 DFnetlist& operator[](
const std::string& fname);
812 const DFnetlist& operator[](
const std::string& fname)
const;
826 const DFnetlist& operator[](funcID
id)
const;
bool validChannel(channelID id) const
Indicates whether a channel id is valid.
Definition: Dataflow.cpp:376
int getBufferSize(blockID id) const
Returns the number of slots of an elastic buffer.
Definition: Dataflow.cpp:107
portID getConnectedPort(portID port) const
Returns the opposite port connected to the same channel.
Definition: Dataflow.cpp:242
bool removeControl()
Remove the control (synchronization) blocks of the dataflow netlist.
Definition: Dataflow.cpp:476
portID getDemuxDataPort(blockID id) const
Definition: Dataflow.cpp:217
portID getSrcPort(channelID id) const
Returns the source port of a channel.
Definition: Dataflow.cpp:252
portID getPort(blockID block, const std::string &name) const
Returns the id of a port from a given block and pin name.
Definition: Dataflow.cpp:147
bool isOutputPort(portID port) const
Indicates whether a port is output.
Definition: Dataflow.cpp:167
Definition: Dataflow.h:728
int getPortWidth(portID port) const
Returns the width of a port.
Definition: Dataflow.cpp:172
portID getTruePort(blockID id) const
Definition: Dataflow.cpp:207
portID getConditionalPort(blockID id) const
Definition: Dataflow.cpp:202
void eraseNonSCC()
Removes all non-SCC blocks and channels.
Definition: Dataflow.cpp:461
void clearError()
Erases the error.
Definition: Dataflow.cpp:341
void setBlockDelay(blockID id, double d, int indx)
Sets the delay of a block.
Definition: Dataflow.cpp:52
bool calculateBasicBlocks()
Calculates the Basic Blocks of the netlist.
Definition: Dataflow.cpp:466
bool isChannelTransparent(channelID id) const
Checks whether the buffer of the channel is transparent.
Definition: Dataflow.cpp:282
bool addElasticBuffers(double Period=0, double BufferDelay=0, bool maxThroughput=false, double coverage=0)
Adds elastic buffers to meet a certain cycle period and have elasticity in the system.
Definition: Dataflow.cpp:426
void setInitiationInterval(blockID id, int ii)
Sets the initiation interval of a block.
Definition: Dataflow.cpp:82
int numChannels() const
Definition: Dataflow.cpp:356
int getInitiationInterval(blockID id) const
Returns the initiation interval of a block.
Definition: Dataflow.cpp:77
channelID getConnectedChannel(portID port) const
Returns the channel associated to a port.
Definition: Dataflow.cpp:227
bool isBooleanPort(portID port) const
Checks whether a port is Boolean.
Definition: Dataflow.cpp:177
void setBufferTransparency(blockID id, bool value)
Sets the transparency of an elastic buffer.
Definition: Dataflow.cpp:122
bool writeBasicBlockDot(const std::string &filename="")
Writes the Basic Blocks of the dataflow netlist in dot format.
void setMilpSolver(const std::string &solver="cbc")
Sets the solver for MILP optimization problems.
Definition: Dataflow.cpp:421
const setPorts & getPorts(blockID id, PortDirection dir) const
Returns the set of ports with a certain direction.
Definition: Dataflow.cpp:197
void setChannelEB(channelID id)
Sets the presence of an EB on the channel.
Definition: Dataflow.cpp:293
bool isBufferTransparent(blockID id) const
Checks whether the buffer is transparent.
Definition: Dataflow.cpp:117
blockID createBlock(BlockType type, const std::string &name="")
Creates a new block in the netlist.
Definition: Dataflow.cpp:32
bool hasError() const
Indicates whether there is an error.
Definition: Dataflow.cpp:346
blockID getBlock(const std::string &name) const
Returns a block id of the netlist.
Definition: Dataflow.cpp:37
void cleanElasticBuffers()
Removes all the elastic buffers from the netlist.
Definition: Dataflow.cpp:456
bool isControlPort(portID port) const
Checks whether a port is a control port.
Definition: Dataflow.cpp:182
const std::string & getError() const
Definition: Dataflow.cpp:336
bool writeDot(const std::string &filename="")
Writes the dataflow netlist in dot format.
Definition: DFnetlist.h:417
void removePort(portID port)
Removes a port and the associated channels from the netlist.
Definition: Dataflow.cpp:142
DFnetlist()
Implementation of DFnet;.
Definition: Dataflow.cpp:7
void setChannelBufferSize(blockID id, int slots)
Sets the number of slots of the elastic buffer in the channel.
Definition: Dataflow.cpp:277
Definition: Dataflow.h:83
void setError(const std::string &err)
Sets an error message for the netlist.
Definition: Dataflow.cpp:331
bool check()
Checks that the netlist is well-formed.
Definition: Dataflow.cpp:22
std::string getChannelName(channelID id, bool full=true) const
Returns the name of the channel.
Definition: Dataflow.cpp:267
bool optimize()
Performs different types of optimizations to reduce the complexity of the dataflow netlist...
Definition: Dataflow.cpp:471
void setPortDelay(portID port, double d)
Sets the delay of a port.
Definition: Dataflow.cpp:192
~DFnetlist()
Default destructor.
Definition: Dataflow.cpp:17
void setBufferSize(blockID id, int slots)
Sets the number of slots of an elastic buffer.
Definition: Dataflow.cpp:112
portID getDemuxComplementaryPort(portID port) const
Returns the complementary port associated to one of the ports of a demux. If the parameter is an inpu...
Definition: Dataflow.cpp:222
bool validPort(portID p) const
Definition: Dataflow.cpp:366
bool isInputPort(portID port) const
Indicates whether a port is input.
Definition: Dataflow.cpp:162
void instantiateAdditionalElasticBuffers(const std::string &filename)
Creates buffers for all those channels annotated inside input file. // Carmine 09.02.22.
Definition: Dataflow.cpp:446
bool isPortConnected(portID port) const
Checks whether a port is connected.
Definition: Dataflow.cpp:237
bool validBlock(blockID id) const
Indicates whether a block id is valid.
Definition: Dataflow.cpp:371
blockID getBlockFromPort(portID p) const
Definition: Dataflow.cpp:127
Definition: DFnetlist.h:2214
const std::string & getBlockName(blockID id) const
Returns the name of a block.
Definition: Dataflow.cpp:42
portID getFalsePort(blockID id) const
Definition: Dataflow.cpp:212
portID getDstPort(channelID id) const
Returns the destination port of a channel.
Definition: Dataflow.cpp:257
void removeBuffer(blockID buf)
Removes a buffer and reconnects the input and output channels.
Definition: Dataflow.cpp:326
double extractMarkedGraphs(double coverage)
Extracts a set of marked graphs from the netlist until a certain coverage of execution frequency is a...
Definition: Dataflow.cpp:481
bool getChannelEB(channelID id)
Gets the presence of an EB on the channel.
Definition: Dataflow.cpp:298
const std::string & getName() const
Definition: Dataflow.cpp:27
int getChannelBufferSize(channelID id) const
Returns the number of slots of the elastic buffer in the channel.
Definition: Dataflow.cpp:272
double getBlockDelay(blockID id, int indx) const
Returns the delay of a block.
Definition: Dataflow.cpp:47
void hideElasticBuffers()
Removes the elastic buffers and transfers the information to the channels.
Definition: Dataflow.cpp:451
portID createPort(blockID block, bool isInput, const std::string &name="", int width=-1, PortType type=GENERIC_PORT)
Adds a new port to a block.
Definition: Dataflow.cpp:137
channelID getChannelID(portID id)
Returns the channel ID.
void removeBlock(blockID block)
Removes a block and all the associated channels from the netlist.
Definition: Dataflow.cpp:132
int numBlocks() const
Definition: Dataflow.cpp:351
void setTrueFrac(blockID id, double freq)
Sets the true/false exe. fraction of a select op.
Definition: Dataflow.cpp:97
double getPortDelay(portID port) const
Returns the delay of a port.
Definition: Dataflow.cpp:187
int numPorts() const
Definition: Dataflow.cpp:361
channelID createChannel(portID src, portID dst)
Creates a channel between two ports.
Definition: Dataflow.cpp:247
void removeChannel(channelID id)
Removes a channel.
Definition: Dataflow.cpp:262
const std::string & getPortName(portID port, bool full=true) const
Returns the name of a port.
Definition: Dataflow.cpp:152
blockID insertBuffer(channelID c, int slots, bool transparent)
Inserts a buffer in a channel. The insertion removes the previous channel and creates two new channel...
Definition: Dataflow.cpp:316
void setExecutionFrequency(blockID id, double freq)
Sets the execution frequency of a block.
Definition: Dataflow.cpp:92
void instantiateElasticBuffers()
Creates buffers for all those channels annotated with buffers. The information in the channels is del...
Definition: Dataflow.cpp:441
void setLatency(blockID id, int lat)
Sets the latency of a block.
Definition: Dataflow.cpp:72
void setChannelTransparency(channelID id, bool value)
Sets the transparency of the elastic buffer in the channel.
Definition: Dataflow.cpp:288
bool hasBuffer(channelID id) const
Checks whether a channel has an elastic buffer (slots > 0).
Definition: Dataflow.cpp:311
BlockType getBlockType(blockID block) const
Returns the block type associated to a block.
Definition: Dataflow.cpp:232
PortType getPortType(portID port) const
Returns the type of a port.
Definition: Dataflow.cpp:157
int getLatency(blockID id) const
Returns the latency of a block.
Definition: Dataflow.cpp:67
void reduceMerges()
Reduce the number of merges since 1 input merges can be reduced to a wire.
Definition: Dataflow.cpp:417
int getExecutionFrequency(blockID id) const
Returns the execution frequency of a block.
Definition: Dataflow.cpp:87