Verilog to Routing - VPR
Functions
atom_netlist_utils.cpp File Reference
#include "atom_netlist_utils.h"
#include <map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <iterator>
#include <cmath>
#include "vtr_assert.h"
#include "vtr_log.h"
#include "vpr_error.h"
#include "vpr_utils.h"
Include dependency graph for atom_netlist_utils.cpp:

Functions

int infer_and_mark_constant_pins (AtomNetlist &netlist, e_const_gen_inference const_gen_inference_method, int verbosity)
 Marks primitive output pins constant if all inputs to the block are constant. More...
 
int mark_undriven_primitive_outputs_as_constant (AtomNetlist &netlist, int verbosity)
 Marks all primtive output pins which have no combinationally connected inputs as constant pins. More...
 
int infer_and_mark_block_pins_constant (AtomNetlist &netlist, AtomBlockId blk, e_const_gen_inference const_gen_inference_method, int verbosity)
 Marks all primtive output pins of blk which have only constant inputs as constant pins. More...
 
int infer_and_mark_block_combinational_outputs_constant (AtomNetlist &netlist, AtomBlockId blk, e_const_gen_inference const_gen_inference_method, int verbosity)
 
int infer_and_mark_block_sequential_outputs_constant (AtomNetlist &netlist, AtomBlockId blk, e_const_gen_inference const_gen_inference_method, int verbosity)
 
std::vector< AtomPortIdfind_combinationally_connected_input_ports (const AtomNetlist &netlist, AtomPortId output_port)
 Returns the set of input ports which are combinationally connected to output_port. More...
 
std::vector< AtomPortIdfind_combinationally_connected_clock_ports (const AtomNetlist &netlist, AtomPortId output_port)
 Returns the set of clock ports which are combinationally connected to output_port. More...
 
bool is_buffer_lut (const AtomNetlist &netlist, const AtomBlockId blk)
 
bool is_removable_block (const AtomNetlist &netlist, const AtomBlockId blk, std::string *reason=nullptr)
 
bool is_removable_input (const AtomNetlist &netlist, const AtomBlockId blk, std::string *reason=nullptr)
 
bool is_removable_output (const AtomNetlist &netlist, const AtomBlockId blk, std::string *reason=nullptr)
 
bool remove_buffer_lut (AtomNetlist &netlist, AtomBlockId blk, int verbosity)
 Attempts to remove the specified buffer LUT blk from the netlist. More...
 
std::string make_unconn (size_t &unconn_count, PinType type)
 
void cube_to_minterms_recurr (std::vector< vtr::LogicValue > cube, std::vector< size_t > &minterms)
 
void print_netlist_as_blif (std::string filename, const AtomNetlist &netlist)
 
void print_netlist_as_blif (FILE *f, const AtomNetlist &netlist)
 
std::string atom_pin_arch_name (const AtomNetlist &netlist, const AtomPinId pin)
 Returns a user-friendly architectural identifier for the specified atom pin. More...
 
int mark_constant_generators (AtomNetlist &netlist, e_const_gen_inference const_gen_inference_method, int verbosity)
 Walk through the netlist detecting constant generators. More...
 
void absorb_buffer_luts (AtomNetlist &netlist, int verbosity)
 Modifies the netlist by absorbing buffer LUTs. More...
 
size_t sweep_constant_primary_outputs (AtomNetlist &netlist, int verbosity)
 
size_t sweep_iterative (AtomNetlist &netlist, bool should_sweep_ios, bool should_sweep_nets, bool should_sweep_blocks, bool should_sweep_constant_primary_outputs, e_const_gen_inference const_gen_inference_method, int verbosity)
 Repeatedly sweeps the netlist removing blocks and nets until nothing more can be swept. If sweep_ios is true also sweeps primary-inputs and primary-outputs. More...
 
size_t sweep_blocks (AtomNetlist &netlist, int verbosity)
 Sweeps blocks that have no fanout. More...
 
size_t sweep_inputs (AtomNetlist &netlist, int verbosity)
 Sweeps primary-inputs with no fanout. More...
 
size_t sweep_outputs (AtomNetlist &netlist, int verbosity)
 Sweeps primary-outputs with no fanin. More...
 
size_t sweep_nets (AtomNetlist &netlist, int verbosity)
 Sweeps nets with no drivers and/or no sinks. More...
 
bool truth_table_encodes_on_set (const AtomNetlist::TruthTable &truth_table)
 Deterimine whether a truth table encodes the logic functions 'On' set (returns true) or 'Off' set (returns false) More...
 
AtomNetlist::TruthTable permute_truth_table (const AtomNetlist::TruthTable &truth_table, const size_t num_inputs, const std::vector< int > &permutation)
 Permutes the inputs of a truth table. More...
 
AtomNetlist::TruthTable expand_truth_table (const AtomNetlist::TruthTable &truth_table, const size_t num_inputs)
 
std::vector< vtr::LogicValue > truth_table_to_lut_mask (const AtomNetlist::TruthTable &truth_table, const size_t num_inputs)
 Convers a truth table to a lut mask (sequence of binary values representing minterms) More...
 
std::vector< size_t > cube_to_minterms (std::vector< vtr::LogicValue > cube)
 Convers a logic cube (potnetially including don't cares) into a sequence of minterm numbers. More...
 
std::set< AtomNetIdfind_netlist_physical_clock_nets (const AtomNetlist &netlist)
 Find all the nets connected to clock pins in the netlist. More...
 
std::set< AtomPinIdfind_netlist_logical_clock_drivers (const AtomNetlist &netlist)
 Finds all logical clock drivers in the netlist (by back-tracing through logic) More...
 
void print_netlist_clock_info (const AtomNetlist &netlist)
 Print information about clocks. More...
 
bool is_buffer (const AtomNetlist &netlist, const AtomBlockId blk)
 Returns true if the specified block is a logical buffer. More...
 

Function Documentation

◆ absorb_buffer_luts()

void absorb_buffer_luts ( AtomNetlist netlist,
int  verbosity 
)

Modifies the netlist by absorbing buffer LUTs.

◆ atom_pin_arch_name()

std::string atom_pin_arch_name ( const AtomNetlist netlist,
const AtomPinId  pin 
)

Returns a user-friendly architectural identifier for the specified atom pin.

◆ cube_to_minterms()

std::vector<size_t> cube_to_minterms ( std::vector< vtr::LogicValue >  cube)

Convers a logic cube (potnetially including don't cares) into a sequence of minterm numbers.

◆ cube_to_minterms_recurr()

void cube_to_minterms_recurr ( std::vector< vtr::LogicValue >  cube,
std::vector< size_t > &  minterms 
)

◆ expand_truth_table()

AtomNetlist::TruthTable expand_truth_table ( const AtomNetlist::TruthTable truth_table,
const size_t  num_inputs 
)

Returns the truth table expanded to use num_inputs inputs. Typical usage is to expand the truth table of a LUT which is logically smaller than the one provided by the architecture (e.g. implement a 2-LUT in a 6-LUT)

Parameters
truth_tableThe truth table to expand
num_inputsThe number of inputs to use

◆ find_combinationally_connected_clock_ports()

std::vector< AtomPortId > find_combinationally_connected_clock_ports ( const AtomNetlist netlist,
AtomPortId  output_port 
)

Returns the set of clock ports which are combinationally connected to output_port.

◆ find_combinationally_connected_input_ports()

std::vector< AtomPortId > find_combinationally_connected_input_ports ( const AtomNetlist netlist,
AtomPortId  output_port 
)

Returns the set of input ports which are combinationally connected to output_port.

◆ find_netlist_logical_clock_drivers()

std::set<AtomPinId> find_netlist_logical_clock_drivers ( const AtomNetlist netlist)

Finds all logical clock drivers in the netlist (by back-tracing through logic)

Returns the set of pins which logically drive unique clocks in the netlist.

◆ find_netlist_physical_clock_nets()

std::set<AtomNetId> find_netlist_physical_clock_nets ( const AtomNetlist netlist)

Find all the nets connected to clock pins in the netlist.

Returns the set of nets which drive clock pins in the netlist.

◆ infer_and_mark_block_combinational_outputs_constant()

int infer_and_mark_block_combinational_outputs_constant ( AtomNetlist netlist,
AtomBlockId  blk,
e_const_gen_inference  const_gen_inference_method,
int  verbosity 
)

◆ infer_and_mark_block_pins_constant()

int infer_and_mark_block_pins_constant ( AtomNetlist netlist,
AtomBlockId  blk,
e_const_gen_inference  const_gen_inference_method,
int  verbosity 
)

Marks all primtive output pins of blk which have only constant inputs as constant pins.

◆ infer_and_mark_block_sequential_outputs_constant()

int infer_and_mark_block_sequential_outputs_constant ( AtomNetlist netlist,
AtomBlockId  blk,
e_const_gen_inference  const_gen_inference_method,
int  verbosity 
)

◆ infer_and_mark_constant_pins()

int infer_and_mark_constant_pins ( AtomNetlist netlist,
e_const_gen_inference  const_gen_inference_method,
int  verbosity 
)

Marks primitive output pins constant if all inputs to the block are constant.

Since marking one block constant may cause a downstream block to also be constant, marking is repated until there is no further change

◆ is_buffer()

bool is_buffer ( const AtomNetlist netlist,
const AtomBlockId  blk 
)

Returns true if the specified block is a logical buffer.

◆ is_buffer_lut()

bool is_buffer_lut ( const AtomNetlist netlist,
const AtomBlockId  blk 
)

◆ is_removable_block()

bool is_removable_block ( const AtomNetlist netlist,
const AtomBlockId  blk,
std::string *  reason = nullptr 
)

◆ is_removable_input()

bool is_removable_input ( const AtomNetlist netlist,
const AtomBlockId  blk,
std::string *  reason = nullptr 
)

◆ is_removable_output()

bool is_removable_output ( const AtomNetlist netlist,
const AtomBlockId  blk,
std::string *  reason = nullptr 
)

◆ make_unconn()

std::string make_unconn ( size_t &  unconn_count,
PinType  type 
)

◆ mark_constant_generators()

int mark_constant_generators ( AtomNetlist netlist,
e_const_gen_inference  const_gen_inference_method,
int  verbosity 
)

Walk through the netlist detecting constant generators.

Note
Initial constant generators (e.g. vcc/gnd) should have already been marked on the netlist.

◆ mark_undriven_primitive_outputs_as_constant()

int mark_undriven_primitive_outputs_as_constant ( AtomNetlist netlist,
int  verbosity 
)

Marks all primtive output pins which have no combinationally connected inputs as constant pins.

◆ permute_truth_table()

AtomNetlist::TruthTable permute_truth_table ( const AtomNetlist::TruthTable truth_table,
const size_t  num_inputs,
const std::vector< int > &  permutation 
)

Permutes the inputs of a truth table.

Parameters
truth_tableThe truth table to expand
num_inputsThe number of inputs to use
permutationA vector indicies to permute, permutation[i] is the input pin where the signal currently connected to input i should be placed

◆ print_netlist_as_blif() [1/2]

void print_netlist_as_blif ( std::string  filename,
const AtomNetlist netlist 
)

◆ print_netlist_as_blif() [2/2]

void print_netlist_as_blif ( FILE *  f,
const AtomNetlist netlist 
)

◆ print_netlist_clock_info()

void print_netlist_clock_info ( const AtomNetlist netlist)

Print information about clocks.

Prints out information about netlist clocks.

◆ remove_buffer_lut()

bool remove_buffer_lut ( AtomNetlist netlist,
AtomBlockId  blk,
int  verbosity 
)

Attempts to remove the specified buffer LUT blk from the netlist.

Returns
true if successful

◆ sweep_blocks()

size_t sweep_blocks ( AtomNetlist netlist,
int  verbosity 
)

Sweeps blocks that have no fanout.

◆ sweep_constant_primary_outputs()

size_t sweep_constant_primary_outputs ( AtomNetlist netlist,
int  verbosity 
)

◆ sweep_inputs()

size_t sweep_inputs ( AtomNetlist netlist,
int  verbosity 
)

Sweeps primary-inputs with no fanout.

◆ sweep_iterative()

size_t sweep_iterative ( AtomNetlist netlist,
bool  should_sweep_ios,
bool  should_sweep_nets,
bool  should_sweep_blocks,
bool  should_sweep_constant_primary_outputs,
e_const_gen_inference  const_gen_inference_method,
int  verbosity 
)

Repeatedly sweeps the netlist removing blocks and nets until nothing more can be swept. If sweep_ios is true also sweeps primary-inputs and primary-outputs.

◆ sweep_nets()

size_t sweep_nets ( AtomNetlist netlist,
int  verbosity 
)

Sweeps nets with no drivers and/or no sinks.

◆ sweep_outputs()

size_t sweep_outputs ( AtomNetlist netlist,
int  verbosity 
)

Sweeps primary-outputs with no fanin.

◆ truth_table_encodes_on_set()

bool truth_table_encodes_on_set ( const AtomNetlist::TruthTable truth_table)

Deterimine whether a truth table encodes the logic functions 'On' set (returns true) or 'Off' set (returns false)

◆ truth_table_to_lut_mask()

std::vector<vtr::LogicValue> truth_table_to_lut_mask ( const AtomNetlist::TruthTable truth_table,
const size_t  num_inputs 
)

Convers a truth table to a lut mask (sequence of binary values representing minterms)