Verilog to Routing - VPR
Public Member Functions | Private Member Functions | Private Attributes
NetlistWriterVisitor Class Reference

A class which writes post-synthesis netlists (Verilog and BLIF) and the SDF. More...

Inheritance diagram for NetlistWriterVisitor:
Inheritance graph
[legend]
Collaboration diagram for NetlistWriterVisitor:
Collaboration graph
[legend]

Public Member Functions

 NetlistWriterVisitor (std::ostream &verilog_os, std::ostream &blif_os, std::ostream &sdf_os, std::shared_ptr< const AnalysisDelayCalculator > delay_calc)
 
 NetlistWriterVisitor (NetlistWriterVisitor &other)=delete
 
 NetlistWriterVisitor (NetlistWriterVisitor &&other)=delete
 
NetlistWriterVisitoroperator= (NetlistWriterVisitor &rhs)=delete
 
NetlistWriterVisitoroperator= (NetlistWriterVisitor &&rhs)=delete
 
- Public Member Functions inherited from NetlistVisitor
virtual ~NetlistVisitor ()=default
 
void start ()
 
void visit_top (const char *top_level_name)
 
void visit_clb (ClusterBlockId blk_id, const t_pb *clb)
 
void visit_atom (const t_pb *atom)
 visit_atom is called on leaf pb nodes that map to a netlist element. More...
 
void visit_route_through (const t_pb *atom)
 visit_route_through is called on leaf pb nodes that do not map to a netlist element. More...
 
void visit_all (const t_pb_routes &top_pb_route, const t_pb *pb)
 visit_all is called on all t_pb nodes that are in use for any reason. More...
 
void finish ()
 

Private Member Functions

void visit_top_impl (const char *top_level_name) override
 
void visit_atom_impl (const t_pb *atom) override
 
void finish_impl () override
 
void print_verilog (int depth=0)
 Writes out the verilog netlist. More...
 
void print_blif (int depth=0)
 Writes out the blif netlist. More...
 
void print_sdf (int depth=0)
 Writes out the SDF. More...
 
std::string make_inst_wire (AtomNetId atom_net_id, tatum::NodeId tnode_id, std::string inst_name, PortType port_type, int port_idx, int pin_idx)
 Returns the name of a wire connecting a primitive and global net. More...
 
std::string make_io (const t_pb *atom, PortType dir)
 Returns the name of a circuit-level Input/Output. More...
 
std::shared_ptr< Instancemake_lut_instance (const t_pb *atom)
 Returns an Instance object representing the LUT. More...
 
std::shared_ptr< Instancemake_latch_instance (const t_pb *atom)
 Returns an Instance object representing the Latch. More...
 
std::shared_ptr< Instancemake_ram_instance (const t_pb *atom)
 Returns an Instance object representing the RAM. More...
 
std::shared_ptr< Instancemake_multiply_instance (const t_pb *atom)
 Returns an Instance object representing a Multiplier. More...
 
std::shared_ptr< Instancemake_adder_instance (const t_pb *atom)
 Returns an Instance object representing an Adder. More...
 
std::shared_ptr< Instancemake_blackbox_instance (const t_pb *atom)
 
const t_pb_routesfind_top_pb_route (const t_pb *curr)
 Returns the top level pb_route associated with the given pb. More...
 
const t_pbfind_top_cb (const t_pb *curr)
 Returns the top complex block which contains the given pb. More...
 
tatum::NodeId find_tnode (const t_pb *atom, int cluster_pin_idx)
 Returns the tnode ID of the given atom's connected cluster pin. More...
 
LogicVec load_lut_mask (size_t num_inputs, const t_pb *atom)
 Returns a LogicVec representing the LUT mask of the given LUT atom. More...
 
std::vector< int > determine_lut_permutation (size_t num_inputs, const t_pb *atom_pb)
 Helper function for load_lut_mask() which determines how the LUT inputs were permuted compared to the input BLIF. More...
 
bool names_encodes_on_set (vtr::t_linked_vptr *names_row_ptr)
 Helper function for load_lut_mask() which determines if the names is encodeing the ON (returns true) or OFF (returns false) set. More...
 
LogicVec names_row_to_logic_vec (const std::string names_row, size_t num_inputs, bool encoding_on_set)
 Helper function for load_lut_mask() More...
 
int find_num_inputs (const t_pb *pb)
 Returns the total number of input pins on the given pb. More...
 
AtomNetId find_atom_input_logical_net (const t_pb *atom, int atom_input_idx)
 Returns the logical net ID. More...
 
std::string interconnect_name (std::string driver_wire, std::string sink_wire)
 Returns the name of the routing segment between two wires. More...
 
double get_delay_ps (tatum::NodeId source_tnode, tatum::NodeId sink_tnode)
 Returns the delay in pico-seconds from source_tnode to sink_tnode. More...
 

Private Attributes

std::string top_module_name_
 
std::vector< std::string > inputs_
 
std::vector< std::string > outputs_
 
std::vector< Assignmentassignments_
 
std::vector< std::shared_ptr< Instance > > cell_instances_
 
std::map< AtomNetId, std::pair< std::string, tatum::NodeId > > logical_net_drivers_
 
std::map< AtomNetId, std::vector< std::pair< std::string, tatum::NodeId > > > logical_net_sinks_
 
std::map< std::string, float > logical_net_sink_delays_
 
std::ostream & verilog_os_
 
std::ostream & blif_os_
 
std::ostream & sdf_os_
 
std::map< std::pair< ClusterBlockId, int >, tatum::NodeId > pin_id_to_tnode_lookup_
 
std::shared_ptr< const AnalysisDelayCalculator > delay_calc_
 

Additional Inherited Members

- Protected Member Functions inherited from NetlistVisitor
virtual void start_impl ()
 
virtual void visit_clb_impl (ClusterBlockId blk_id, const t_pb *clb)
 
virtual void visit_route_through_impl (const t_pb *atom)
 
virtual void visit_all_impl (const t_pb_routes &top_pb_route, const t_pb *pb)
 

Detailed Description

A class which writes post-synthesis netlists (Verilog and BLIF) and the SDF.

It implements the NetlistVisitor interface used by NetlistWalker (see netlist_walker.h)

Constructor & Destructor Documentation

◆ NetlistWriterVisitor() [1/3]

NetlistWriterVisitor::NetlistWriterVisitor ( std::ostream &  verilog_os,
std::ostream &  blif_os,
std::ostream &  sdf_os,
std::shared_ptr< const AnalysisDelayCalculator >  delay_calc 
)
inline
Parameters
verilog_osOutput stream for verilog netlist
blif_osOutput stream for blif netlist
sdf_osOutput stream for SDF

◆ NetlistWriterVisitor() [2/3]

NetlistWriterVisitor::NetlistWriterVisitor ( NetlistWriterVisitor other)
delete

◆ NetlistWriterVisitor() [3/3]

NetlistWriterVisitor::NetlistWriterVisitor ( NetlistWriterVisitor &&  other)
delete

Member Function Documentation

◆ determine_lut_permutation()

std::vector<int> NetlistWriterVisitor::determine_lut_permutation ( size_t  num_inputs,
const t_pb atom_pb 
)
inlineprivate

Helper function for load_lut_mask() which determines how the LUT inputs were permuted compared to the input BLIF.

Since the LUT inputs may have been rotated from the input blif specification we need to figure out this permutation to reflect the physical implementation connectivity.

We return a permutation map (which is a list of swaps from index to index) which is then applied to do the rotation of the lutmask.

The net in the atom netlist which was originally connected to pin i, is connected to pin permute[i] in the implementation.

◆ find_atom_input_logical_net()

AtomNetId NetlistWriterVisitor::find_atom_input_logical_net ( const t_pb atom,
int  atom_input_idx 
)
inlineprivate

Returns the logical net ID.

◆ find_num_inputs()

int NetlistWriterVisitor::find_num_inputs ( const t_pb pb)
inlineprivate

Returns the total number of input pins on the given pb.

◆ find_tnode()

tatum::NodeId NetlistWriterVisitor::find_tnode ( const t_pb atom,
int  cluster_pin_idx 
)
inlineprivate

Returns the tnode ID of the given atom's connected cluster pin.

◆ find_top_cb()

const t_pb* NetlistWriterVisitor::find_top_cb ( const t_pb curr)
inlineprivate

Returns the top complex block which contains the given pb.

◆ find_top_pb_route()

const t_pb_routes& NetlistWriterVisitor::find_top_pb_route ( const t_pb curr)
inlineprivate

Returns the top level pb_route associated with the given pb.

◆ finish_impl()

void NetlistWriterVisitor::finish_impl ( )
inlineoverrideprivatevirtual

Reimplemented from NetlistVisitor.

◆ get_delay_ps()

double NetlistWriterVisitor::get_delay_ps ( tatum::NodeId  source_tnode,
tatum::NodeId  sink_tnode 
)
inlineprivate

Returns the delay in pico-seconds from source_tnode to sink_tnode.

◆ interconnect_name()

std::string NetlistWriterVisitor::interconnect_name ( std::string  driver_wire,
std::string  sink_wire 
)
inlineprivate

Returns the name of the routing segment between two wires.

◆ load_lut_mask()

LogicVec NetlistWriterVisitor::load_lut_mask ( size_t  num_inputs,
const t_pb atom 
)
inlineprivate

Returns a LogicVec representing the LUT mask of the given LUT atom.

◆ make_adder_instance()

std::shared_ptr<Instance> NetlistWriterVisitor::make_adder_instance ( const t_pb atom)
inlineprivate

Returns an Instance object representing an Adder.

◆ make_blackbox_instance()

std::shared_ptr<Instance> NetlistWriterVisitor::make_blackbox_instance ( const t_pb atom)
inlineprivate

◆ make_inst_wire()

std::string NetlistWriterVisitor::make_inst_wire ( AtomNetId  atom_net_id,
tatum::NodeId  tnode_id,
std::string  inst_name,
PortType  port_type,
int  port_idx,
int  pin_idx 
)
inlineprivate

Returns the name of a wire connecting a primitive and global net.

The wire is recorded and instantiated by the top level output routines.

< The instance pin index

Parameters
atom_net_idThe id of the net in the atom netlist
tnode_idThe tnode associated with the primitive pin
inst_nameThe name of the instance associated with the pin
port_typeThe port direction
port_idxThe instance port index

◆ make_io()

std::string NetlistWriterVisitor::make_io ( const t_pb atom,
PortType  dir 
)
inlineprivate

Returns the name of a circuit-level Input/Output.

The I/O is recorded and instantiated by the top level output routines

Parameters
atomThe implementation primitive representing the I/O
dirThe IO direction

◆ make_latch_instance()

std::shared_ptr<Instance> NetlistWriterVisitor::make_latch_instance ( const t_pb atom)
inlineprivate

Returns an Instance object representing the Latch.

◆ make_lut_instance()

std::shared_ptr<Instance> NetlistWriterVisitor::make_lut_instance ( const t_pb atom)
inlineprivate

Returns an Instance object representing the LUT.

◆ make_multiply_instance()

std::shared_ptr<Instance> NetlistWriterVisitor::make_multiply_instance ( const t_pb atom)
inlineprivate

Returns an Instance object representing a Multiplier.

◆ make_ram_instance()

std::shared_ptr<Instance> NetlistWriterVisitor::make_ram_instance ( const t_pb atom)
inlineprivate

Returns an Instance object representing the RAM.

Note
the primtive interface to dual and single port rams is nearly identical, so we using a single function to handle both

◆ names_encodes_on_set()

bool NetlistWriterVisitor::names_encodes_on_set ( vtr::t_linked_vptr *  names_row_ptr)
inlineprivate

Helper function for load_lut_mask() which determines if the names is encodeing the ON (returns true) or OFF (returns false) set.

◆ names_row_to_logic_vec()

LogicVec NetlistWriterVisitor::names_row_to_logic_vec ( const std::string  names_row,
size_t  num_inputs,
bool  encoding_on_set 
)
inlineprivate

Helper function for load_lut_mask()

Converts the given names_row string to a LogicVec

◆ operator=() [1/2]

NetlistWriterVisitor& NetlistWriterVisitor::operator= ( NetlistWriterVisitor rhs)
delete

◆ operator=() [2/2]

NetlistWriterVisitor& NetlistWriterVisitor::operator= ( NetlistWriterVisitor &&  rhs)
delete

◆ print_blif()

void NetlistWriterVisitor::print_blif ( int  depth = 0)
inlineprivate

Writes out the blif netlist.

◆ print_sdf()

void NetlistWriterVisitor::print_sdf ( int  depth = 0)
inlineprivate

Writes out the SDF.

◆ print_verilog()

void NetlistWriterVisitor::print_verilog ( int  depth = 0)
inlineprivate

Writes out the verilog netlist.

◆ visit_atom_impl()

void NetlistWriterVisitor::visit_atom_impl ( const t_pb atom)
inlineoverrideprivatevirtual

Reimplemented from NetlistVisitor.

◆ visit_top_impl()

void NetlistWriterVisitor::visit_top_impl ( const char *  top_level_name)
inlineoverrideprivatevirtual

Reimplemented from NetlistVisitor.

Field Documentation

◆ assignments_

std::vector<Assignment> NetlistWriterVisitor::assignments_
private

Set of assignments (i.e. net-to-net connections)

◆ blif_os_

std::ostream& NetlistWriterVisitor::blif_os_
private

◆ cell_instances_

std::vector<std::shared_ptr<Instance> > NetlistWriterVisitor::cell_instances_
private

Set of cell instances

◆ delay_calc_

std::shared_ptr<const AnalysisDelayCalculator> NetlistWriterVisitor::delay_calc_
private

◆ inputs_

std::vector<std::string> NetlistWriterVisitor::inputs_
private

Name of circuit inputs

◆ logical_net_drivers_

std::map<AtomNetId, std::pair<std::string, tatum::NodeId> > NetlistWriterVisitor::logical_net_drivers_
private

◆ logical_net_sink_delays_

std::map<std::string, float> NetlistWriterVisitor::logical_net_sink_delays_
private

◆ logical_net_sinks_

std::map<AtomNetId, std::vector<std::pair<std::string, tatum::NodeId> > > NetlistWriterVisitor::logical_net_sinks_
private

◆ outputs_

std::vector<std::string> NetlistWriterVisitor::outputs_
private

Name of circuit outputs

◆ pin_id_to_tnode_lookup_

std::map<std::pair<ClusterBlockId, int>, tatum::NodeId> NetlistWriterVisitor::pin_id_to_tnode_lookup_
private

◆ sdf_os_

std::ostream& NetlistWriterVisitor::sdf_os_
private

◆ top_module_name_

std::string NetlistWriterVisitor::top_module_name_
private

Name of the top level module (i.e. the circuit)

◆ verilog_os_

std::ostream& NetlistWriterVisitor::verilog_os_
private

The documentation for this class was generated from the following file: