Skip to content

Commit

Permalink
Merge pull request #2238 from verilog-to-routing/s10_vqm2blif_mode_ha…
Browse files Browse the repository at this point in the history
…shed_names

Stratix 10 VQM2BLIF Updates
  • Loading branch information
vaughnbetz committed Jun 30, 2023
2 parents d62ad56 + 02906d2 commit 0509255
Show file tree
Hide file tree
Showing 11 changed files with 919 additions and 334 deletions.
6 changes: 0 additions & 6 deletions libs/libarchfpga/src/read_xml_arch_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4231,12 +4231,6 @@ static void ProcessDirects(pugi::xml_node Parent, t_direct_inf** Directs, int* N
(*Directs)[i].switch_type = -1;
}

/* Check that the direct chain connection is not zero in both direction */
if ((*Directs)[i].x_offset == 0 && (*Directs)[i].y_offset == 0 && (*Directs)[i].sub_tile_offset == 0) {
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Node),
"The x_offset, y_offset, z_offset are all zero, this is a length 0 direct chain connection.\n");
}

(*Directs)[i].line = loc_data.line(Node);
/* Should I check that the direct chain offset is not greater than the chip? How? */

Expand Down
4 changes: 2 additions & 2 deletions libs/libvqm/vqm_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ Connection: '.' TOKEN_REGULARID '(' Identifier ')'
array_of_connections->array_size = 0;
array_of_connections->allocated_size = 0;

port_associations = associate_identifier_with_port_name(ident, $2, -1);
port_associations = associate_identifier_with_port_name(ident, $2, 0);
if (port_associations != NULL)
{
for(index = 0; index < port_associations->array_size; index++)
Expand Down Expand Up @@ -574,7 +574,7 @@ Connection: '.' TOKEN_REGULARID '(' Identifier ')'
array_of_connections->array_size = 0;
array_of_connections->allocated_size = 0;

port_associations = associate_identifier_with_port_name(ident, $2, -1);
port_associations = associate_identifier_with_port_name(ident, $2, 0);
if (port_associations != NULL)
{
for(index = 0; index < port_associations->array_size; index++)
Expand Down
67 changes: 33 additions & 34 deletions utils/vqm2blif/src/base/cleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
// INTERNAL FUNCTION DECLARATIONS
//============================================================================================
//Cleanup Functions
void build_netlist (t_module* module, busvec* buses, s_hash** hash_table);
void init_nets (t_pin_def** pins, int num_pins, busvec* buses, struct s_hash** hash_table);
void set_net_assigns (t_assign** assignments, int num_assigns, busvec* buses, struct s_hash** hash_table);
void add_subckts (t_node** nodes, int num_nodes, busvec* buses, struct s_hash** hash_table);
void remove_one_lut_nodes ( busvec* buses, struct s_hash** hash_table, t_module* module );
void clean_netlist ( busvec* buses, struct s_hash** hash_table, t_node** nodes, int num_nodes );
void build_netlist (t_module* module, busvec* buses, std::unordered_map<std::string, int> & hash_table);
void init_nets (t_pin_def** pins, int num_pins, busvec* buses, std::unordered_map<std::string, int> & hash_table);
void set_net_assigns (t_assign** assignments, int num_assigns, busvec* buses, std::unordered_map<std::string, int> & hash_table);
void add_subckts (t_node** nodes, int num_nodes, busvec* buses, std::unordered_map<std::string, int> & hash_table);
void remove_one_lut_nodes ( busvec* buses, std::unordered_map<std::string, int> & hash_table, t_module* module );
void clean_netlist ( busvec* buses, std::unordered_map<std::string, int> & hash_table, t_node** nodes, int num_nodes );
void reassign_net_source (t_net* net);
void print_to_module ( t_module* module, busvec* buses, struct s_hash** hash_table );
void print_to_module ( t_module* module, busvec* buses, std::unordered_map<std::string, int> & hash_table );

netvec* get_bus_from_hash (struct s_hash** hash_table, char* temp_name, busvec* buses);
netvec* get_bus_from_hash (std::unordered_map<std::string, int> & hash_table, char* temp_name, busvec* buses);

void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, struct s_hash** hash_table);
void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, std::unordered_map<std::string, int> & hash_table);
void print_all_nets ( busvec* buses, const char* filename );

bool is_feeder_onelut ( t_node* node );
Expand All @@ -29,8 +29,7 @@ bool is_feeder_onelut ( t_node* node );

void netlist_cleanup (t_module* module){

struct s_hash** hash_table = alloc_hash_table();

std::unordered_map<std::string, int> hash_table;
busvec buses;

cout << "\t>> Building netlist...\n" ;
Expand Down Expand Up @@ -64,14 +63,12 @@ void netlist_cleanup (t_module* module){

print_to_module ( module, &buses, hash_table );

free_hash_table(hash_table);

}

//============================================================================================
//============================================================================================

void build_netlist (t_module* module, busvec* buses, s_hash** hash_table){
void build_netlist (t_module* module, busvec* buses, std::unordered_map<std::string, int> & hash_table){

//Initialize all nets
init_nets(module->array_of_pins, module->number_of_pins, buses, hash_table);
Expand Down Expand Up @@ -104,15 +101,17 @@ void build_netlist (t_module* module, busvec* buses, s_hash** hash_table){
//============================================================================================
//============================================================================================

void init_nets (t_pin_def** pins, int num_pins, busvec* buses, struct s_hash** hash_table){
void init_nets (t_pin_def** pins, int num_pins, busvec* buses, std::unordered_map<std::string, int> & hash_table){

t_net temp_net;
netvec temp_bus;

for (int i = 0; i < num_pins; i++){
temp_bus.clear(); //reset the temporary bus

insert_in_hash_table(hash_table, pins[i]->name, i); //place the net in the hash table
std::string pin_name(pins[i]->name);

hash_table[pin_name] = i; //place the net in the hash table - the value is the bus index

temp_net.pin = pins[i]; //each bus corresponds to a pin

Expand All @@ -139,7 +138,7 @@ void init_nets (t_pin_def** pins, int num_pins, busvec* buses, struct s_hash** h
//============================================================================================
//============================================================================================

void set_net_assigns (t_assign** assignments, int num_assigns, busvec* buses, struct s_hash** hash_table){
void set_net_assigns (t_assign** assignments, int num_assigns, busvec* buses, std::unordered_map<std::string, int> & hash_table){

t_net* temp_net;
netvec* temp_bus;
Expand Down Expand Up @@ -196,7 +195,7 @@ void set_net_assigns (t_assign** assignments, int num_assigns, busvec* buses, st
//============================================================================================
//============================================================================================

void add_subckts (t_node** nodes, int num_nodes, busvec* buses, struct s_hash** hash_table){
void add_subckts (t_node** nodes, int num_nodes, busvec* buses, std::unordered_map<std::string, int> & hash_table){

t_net* temp_net;
netvec* temp_bus;
Expand Down Expand Up @@ -237,7 +236,7 @@ void add_subckts (t_node** nodes, int num_nodes, busvec* buses, struct s_hash**
//============================================================================================
//============================================================================================

void remove_one_lut_nodes ( busvec* buses, struct s_hash** hash_table, t_module* module ){
void remove_one_lut_nodes ( busvec* buses, std::unordered_map<std::string, int> & hash_table, t_module* module ){
/*
Quartus fitter may have introduced some one-LUTs in the post-fit netlist that makes it harder for VPR to place and route.
Generally, these one-LUTs are inserted by the Quartus router in order to pass a signal through a LUT to the FF in the same
Expand Down Expand Up @@ -376,7 +375,7 @@ void remove_one_lut_nodes ( busvec* buses, struct s_hash** hash_table, t_module*
//============================================================================================
//============================================================================================

void clean_netlist ( busvec* buses, struct s_hash** hash_table, t_node** nodes, int num_nodes ){
void clean_netlist ( busvec* buses, std::unordered_map<std::string, int> & hash_table, t_node** nodes, int num_nodes ){
netvec* temp_bus;

t_net* temp_net;
Expand Down Expand Up @@ -529,7 +528,7 @@ void reassign_net_source (t_net* net){
//============================================================================================
//============================================================================================

void print_to_module ( t_module* module, busvec* buses, struct s_hash** hash_table ){
void print_to_module ( t_module* module, busvec* buses, std::unordered_map<std::string, int> & hash_table ){

t_net* target_net;
t_net* source_net;
Expand Down Expand Up @@ -611,21 +610,22 @@ void print_to_module ( t_module* module, busvec* buses, struct s_hash** hash_tab

//============================================================================================
//============================================================================================
#include <fstream>
netvec* get_bus_from_hash (std::unordered_map<std::string, int> & hash_table, char* bus_name, busvec* buses){

netvec* get_bus_from_hash (struct s_hash** hash_table, char* bus_name, busvec* buses){
s_hash* hash_entry;
std::string bus_name_str(bus_name);
auto hash_entry = hash_table.find(bus_name_str);

hash_entry = get_hash_entry (hash_table, bus_name);
VTR_ASSERT(hash_entry != NULL);
VTR_ASSERT((unsigned int)hash_entry->index < buses->size());
VTR_ASSERT(hash_entry != hash_table.end());
VTR_ASSERT((unsigned int)hash_entry->second < buses->size());

return &(buses->at(hash_entry->index));
return &(buses->at(hash_entry->second));
}

//============================================================================================
//============================================================================================

void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, struct s_hash** hash_table){
void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, std::unordered_map<std::string, int> & hash_table){

netvec* temp_bus;

Expand All @@ -637,8 +637,6 @@ void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, struct s_has

t_pin_def* ref_pin;

s_hash* hash_entry;

cout << "\t>> Verifying netlist...\n" ;

//Step 0: Construct child_count "matrix" corresponding to the net indeces.
Expand All @@ -657,10 +655,11 @@ void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, struct s_has

ref_pin = temp_bus->at(0).pin;

hash_entry = get_hash_entry (hash_table, ref_pin->name);
VTR_ASSERT(hash_entry != NULL);
VTR_ASSERT(hash_entry->index == i);

auto hash_entry = hash_table.find(ref_pin->name);

VTR_ASSERT(hash_entry != hash_table.end());
VTR_ASSERT((unsigned int)hash_entry->second == i);

for (int j = 0; (unsigned int)j < temp_bus->size(); j++){
temp_net = &(temp_bus->at(j));

Expand Down
1 change: 1 addition & 0 deletions utils/vqm2blif/src/base/cleanup.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "vqm2blif_util.h"
#include "lut_recog.h"
#include "vqm_common.h"
#include <unordered_map>

//============================================================================================
// GLOBALS
Expand Down

0 comments on commit 0509255

Please sign in to comment.