diff --git a/README.md b/README.md index 54247b5fd..8d8b479fc 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,7 @@ The OpenFPGA framework is the **first open-source FPGA IP generator** supporting ## Compilation -The different ways of compiling can be found in the [**./compilation**](https://github.com/LNIS-Projects/OpenFPGA/tree/master/compilation) folder.
-Dependancies and help using docker can be found at [**./tutorials/building.md**](https://github.com/LNIS-Projects/OpenFPGA/blob/master/tutorials/building.md). +Dependencies and help using docker can be found at [**./tutorials/building.md**](https://github.com/LNIS-Projects/OpenFPGA/blob/master/tutorials/building.md). **Compilation steps:** 1. git clone https://github.com/LNIS-Projects/OpenFPGA.git && cd OpenFPGA # *Clone the repository and go into it* @@ -21,7 +20,7 @@ Dependancies and help using docker can be found at [**./tutorials/building.md**] *We currently implemented OpenFPGA for:*
*1. Ubuntu 16.04*
*2. Red Hat 7.5*
-*3. MacOS Mojiva 10.13.4*

+*3. MacOS Mojave 10.13.4*

*Please note that those were the versions we tested the software for. It might work with earlier versions and other distributions.* ## Documentation diff --git a/ace2/CMakeLists.txt b/ace2/CMakeLists.txt index 29f831e56..fc090592e 100644 --- a/ace2/CMakeLists.txt +++ b/ace2/CMakeLists.txt @@ -37,6 +37,7 @@ set_target_properties(libace PROPERTIES PREFIX "") #Avoid extra 'lib' prefix#Cre # Specify dependency target_link_libraries(libace libabc + libvtrutil ${CMAKE_DL_LIBS}) add_executable(ace ${EXEC_SOURCES}) diff --git a/ace2/SRC/ace.c b/ace2/SRC/ace.c index 89ce99689..048c39465 100644 --- a/ace2/SRC/ace.c +++ b/ace2/SRC/ace.c @@ -1,3 +1,6 @@ +#include "vtr_assert.h" +#include "vtr_time.h" //For some reason this causes compilation errors if included below the std headers on with g++-5 +#include "vtr_assert.h" #include #include @@ -50,8 +53,7 @@ void print_status(Abc_Ntk_t * ntk) { printf("%d: OLD\n", i); break; default: - printf("Invalid ABC object info status"); - exit(1); + VTR_ASSERT_MSG(false, "Invalid ABC object info status"); } } } @@ -169,11 +171,11 @@ int ace_calc_activity(Abc_Ntk_t * ntk, int num_vectors, char * clk_name) { { info = Ace_ObjInfo(obj); if (strcmp(Abc_ObjName(obj), clk_name) != 0) { - assert(info->static_prob >= 0 && info->static_prob <= 1.0); - assert(info->switch_prob >= 0 && info->switch_prob <= 1.0); - assert(info->switch_act >= 0 && info->switch_act <= 1.0); - assert(info->switch_prob <= 2.0 * (1.0 - info->static_prob)); - assert(info->switch_prob <= 2.0 * info->static_prob); + VTR_ASSERT(info->static_prob >= 0 && info->static_prob <= 1.0); + VTR_ASSERT(info->switch_prob >= 0 && info->switch_prob <= 1.0); + VTR_ASSERT(info->switch_act >= 0 && info->switch_act <= 1.0); + VTR_ASSERT(info->switch_prob <= 2.0 * (1.0 - info->static_prob)); + VTR_ASSERT(info->switch_prob <= 2.0 * info->static_prob); } info->status = ACE_DEF; } @@ -233,11 +235,11 @@ int ace_calc_activity(Abc_Ntk_t * ntk, int num_vectors, char * clk_name) { Ace_Obj_Info_t * info2 = Ace_ObjInfo(obj); info2->switch_act = info2->switch_prob; - assert(info2->switch_act >= 0.0); + VTR_ASSERT(info2->switch_act >= 0.0); } Abc_NtkForEachPi(ntk, obj, i) { - assert(Ace_ObjInfo(obj)->switch_act >= 0.0); + VTR_ASSERT(Ace_ObjInfo(obj)->switch_act >= 0.0); } /*------------- Calculate switching activities. ---------------------*/ @@ -275,7 +277,7 @@ int ace_calc_activity(Abc_Ntk_t * ntk, int num_vectors, char * clk_name) { Ace_Obj_Info_t * info2 = Ace_ObjInfo(obj); //Ace_Obj_Info_t * fanin_info2; - assert(Abc_ObjType(obj) == ABC_OBJ_NODE); + VTR_ASSERT(Abc_ObjType(obj) == ABC_OBJ_NODE); if (Abc_ObjFaninNum(obj) < 1) { info2->switch_act = 0.0; @@ -284,7 +286,7 @@ int ace_calc_activity(Abc_Ntk_t * ntk, int num_vectors, char * clk_name) { Vec_Ptr_t * literals = Vec_PtrAlloc(0); Abc_Obj_t * fanin; - assert(obj->Type == ABC_OBJ_NODE); + VTR_ASSERT(obj->Type == ABC_OBJ_NODE); Abc_ObjForEachFanin(obj, fanin, j) { @@ -294,7 +296,7 @@ int ace_calc_activity(Abc_Ntk_t * ntk, int num_vectors, char * clk_name) { literals); Vec_PtrFree(literals); } - assert(info2->switch_act >= 0); + VTR_ASSERT(info2->switch_act >= 0); } Vec_PtrFree(nodes_logic); Vec_PtrFree(latches_in_cycles_vec); @@ -308,21 +310,22 @@ Ace_Obj_Info_t * Ace_ObjInfo(Abc_Obj_t * obj) { if (st__lookup(ace_info_hash_table, (char *) obj, (char **) &info)) { return info; } - assert(0); + VTR_ASSERT(0); return NULL; } void prob_epsilon_fix(double * d) { if (*d < 0) { - assert(*d > 0 - EPSILON); + VTR_ASSERT(*d > 0 - EPSILON); *d = 0; } else if (*d > 1) { - assert(*d < 1 + EPSILON); + VTR_ASSERT(*d < 1 + EPSILON); *d = 1.; } } int main(int argc, char * argv[]) { + vtr::ScopedFinishTimer t("Ace"); FILE * BLIF = NULL; FILE * IN_ACT = NULL; FILE * OUT_ACT = stdout; @@ -351,7 +354,7 @@ int main(int argc, char * argv[]) { ntk = Io_Read(blif_file_name, IO_FILE_BLIF, 1, 0); - assert(ntk); + VTR_ASSERT(ntk); printf("Objects in network: %d\n", Abc_NtkObjNum(ntk)); printf("PIs in network: %d\n", Abc_NtkPiNum(ntk)); @@ -383,7 +386,7 @@ int main(int argc, char * argv[]) { // Check Depth depth = ace_calc_network_depth(ntk); printf("Max Depth: %d\n", depth); - assert(depth > 0); + VTR_ASSERT(depth > 0); alloc_and_init_activity_info(ntk); diff --git a/ace2/SRC/bdd.c b/ace2/SRC/bdd.c index ce7c367df..2e70218ae 100644 --- a/ace2/SRC/bdd.c +++ b/ace2/SRC/bdd.c @@ -1,5 +1,7 @@ #include +#include "vtr_assert.h" + #include "ace.h" #include "misc/vec/vecPtr.h" #include "bdd.h" @@ -86,7 +88,7 @@ int ace_bdd_build_network_bdds( int i; Vec_Ptr_t * nodes; - assert(Vec_PtrSize(inputs) > 0); + VTR_ASSERT(Vec_PtrSize(inputs) > 0); nodes = Abc_NtkDfsSeq(ntk); @@ -111,8 +113,8 @@ int ace_bdd_build_network_bdds( switch (info->status) { case ACE_SIM: - assert (info->static_prob >= 0.0 && info->static_prob <= 1.0); - assert (info->switch_prob >= 0.0 && info->switch_prob <= 1.0); + VTR_ASSERT (info->static_prob >= 0.0 && info->static_prob <= 1.0); + VTR_ASSERT (info->switch_prob >= 0.0 && info->switch_prob <= 1.0); if (!st_lookup(leaves, (char*) obj, NULL)) { @@ -128,7 +130,7 @@ int ace_bdd_build_network_bdds( break; case ACE_UNDEF: - assert(0); + VTR_ASSERT(0); if (check_pi_status(obj)) { while(1) @@ -149,14 +151,14 @@ int ace_bdd_build_network_bdds( break; case ACE_DEF: - assert(info->static_prob >= 0 && info->static_prob <= 1.0); - assert(info->switch_prob >= 0 && info->switch_prob <= 1.0); + VTR_ASSERT(info->static_prob >= 0 && info->static_prob <= 1.0); + VTR_ASSERT(info->switch_prob >= 0 && info->switch_prob <= 1.0); break; case ACE_NEW: case ACE_OLD: default: - assert(0); + VTR_ASSERT(0); } } @@ -192,7 +194,7 @@ double calc_cube_switch_prob_recur(DdManager * mgr, DdNode * bdd, } /* Get literal index for this bdd node. */ - //assert(0); + //VTR_ASSERT(0); i = Cudd_Regular(bdd)->index; pi = (Abc_Obj_t*) Vec_PtrEntry((Vec_Ptr_t*) inputs, i); @@ -210,11 +212,11 @@ double calc_cube_switch_prob_recur(DdManager * mgr, DdNode * bdd, then_prob = calc_cube_switch_prob_recur(mgr, bdd_if1, cube, inputs, visited, phase); - assert(then_prob + EPSILON >= 0 && then_prob - EPSILON <= 1); + VTR_ASSERT(then_prob + EPSILON >= 0 && then_prob - EPSILON <= 1); else_prob = calc_cube_switch_prob_recur(mgr, bdd_if0, cube, inputs, visited, phase); - assert(else_prob + EPSILON >= 0 && else_prob - EPSILON <= 1); + VTR_ASSERT(else_prob + EPSILON >= 0 && else_prob - EPSILON <= 1); switch (node_get_literal (cube->cube, i)) { case ZERO: @@ -235,7 +237,7 @@ double calc_cube_switch_prob_recur(DdManager * mgr, DdNode * bdd, st__insert(visited, (char *) bdd, (char *) current_prob); - assert(*current_prob + EPSILON >= 0 && *current_prob - EPSILON < 1.0); + VTR_ASSERT(*current_prob + EPSILON >= 0 && *current_prob - EPSILON < 1.0); return (*current_prob); } @@ -250,7 +252,7 @@ double calc_cube_switch_prob(DdManager * mgr, DdNode * bdd, ace_cube_t * cube, st__free_table(visited); - assert(sp + EPSILON >= 0. && sp - EPSILON <= 1.0); + VTR_ASSERT(sp + EPSILON >= 0. && sp - EPSILON <= 1.0); return (sp); } @@ -264,9 +266,9 @@ double calc_switch_prob_recur(DdManager * mgr, DdNode * bdd_next, DdNode * bdd, ace_cube_t * cube0, *cube1; Ace_Obj_Info_t * info; - assert(inputs != NULL); - assert(Vec_PtrSize(inputs) > 0); - assert(P1 >= 0); + VTR_ASSERT(inputs != NULL); + VTR_ASSERT(Vec_PtrSize(inputs) > 0); + VTR_ASSERT(P1 >= 0); if (bdd == Cudd_ReadLogicZero(mgr)) { if (phase != 1) @@ -274,7 +276,7 @@ double calc_switch_prob_recur(DdManager * mgr, DdNode * bdd_next, DdNode * bdd, prob = calc_cube_switch_prob(mgr, bdd_next, cube, inputs, phase); prob *= P1; - assert(prob + EPSILON >= 0. && prob - EPSILON <= 1.); + VTR_ASSERT(prob + EPSILON >= 0. && prob - EPSILON <= 1.); return (prob * P1); } else if (bdd == Cudd_ReadOne(mgr)) { if (phase != 0) @@ -282,7 +284,7 @@ double calc_switch_prob_recur(DdManager * mgr, DdNode * bdd_next, DdNode * bdd, prob = calc_cube_switch_prob(mgr, bdd_next, cube, inputs, phase); prob *= P1; - assert(prob + EPSILON >= 0. && prob - EPSILON <= 1.); + VTR_ASSERT(prob + EPSILON >= 0. && prob - EPSILON <= 1.); return (prob * P1); } @@ -315,8 +317,8 @@ double calc_switch_prob_recur(DdManager * mgr, DdNode * bdd_next, DdNode * bdd, inputs, P1 * (1.0 - info->static_prob), phase); ace_cube_free(cube0); - assert(switch_prob_t + EPSILON >= 0. && switch_prob_t - EPSILON <= 1.); - assert(switch_prob_e + EPSILON >= 0. && switch_prob_e - EPSILON <= 1.); + VTR_ASSERT(switch_prob_t + EPSILON >= 0. && switch_prob_t - EPSILON <= 1.); + VTR_ASSERT(switch_prob_e + EPSILON >= 0. && switch_prob_e - EPSILON <= 1.); return (switch_prob_t + switch_prob_e); } @@ -333,7 +335,7 @@ double ace_bdd_calc_switch_act(DdManager * mgr, Abc_Obj_t * obj, DdNode * bdd; d = info->depth; - assert(d > 0); + VTR_ASSERT(d > 0); d = (int) d * 0.4; if (d < 1) { d = 1; @@ -361,10 +363,10 @@ double ace_bdd_calc_switch_act(DdManager * mgr, Abc_Obj_t * obj, prob_epsilon_fix(&fanin_info->prob0to1); prob_epsilon_fix(&fanin_info->prob1to0); - assert( + VTR_ASSERT( fanin_info->prob0to1 + EPSILON >= 0. && fanin_info->prob0to1 - EPSILON <= 1.0); - assert( + VTR_ASSERT( fanin_info->prob1to0 + EPSILON >= 0. && fanin_info->prob1to0 - EPSILON <= 1.0); } diff --git a/ace2/SRC/cube.c b/ace2/SRC/cube.c index 28c316219..da45cba26 100644 --- a/ace2/SRC/cube.c +++ b/ace2/SRC/cube.c @@ -1,3 +1,4 @@ +#include "vtr_assert.h" #include "cube.h" #include "bdd.h" @@ -16,8 +17,8 @@ ace_cube_t * ace_cube_dup(ace_cube_t * cube) { int i; ace_cube_t * cube_copy; - assert(cube != NULL); - assert(cube->num_literals > 0); + VTR_ASSERT(cube != NULL); + VTR_ASSERT(cube->num_literals > 0); cube_copy = (ace_cube_t*) malloc(sizeof(ace_cube_t)); cube_copy->static_prob = cube->static_prob; @@ -63,8 +64,8 @@ ace_cube_t * ace_cube_new_dc(int num_literals) { } void ace_cube_free(ace_cube_t * cube) { - assert(cube != NULL); - assert(cube->cube != NULL); + VTR_ASSERT(cube != NULL); + VTR_ASSERT(cube->cube != NULL); free(cube->cube); free(cube); } diff --git a/ace2/SRC/cycle.c b/ace2/SRC/cycle.c index c60b2048b..b324377a5 100644 --- a/ace2/SRC/cycle.c +++ b/ace2/SRC/cycle.c @@ -1,3 +1,4 @@ +#include "vtr_assert.h" #include "cycle.h" #include "ace.h" @@ -28,7 +29,7 @@ bool in_cycle(Abc_Ntk_t * ntk, int obj_id_to_find, Abc_Obj_t * starting_obj_ptr, { // Get BI of latch fanin_ptr = Abc_ObjFanin0(Abc_ObjFanin0(starting_obj_ptr)); - assert(fanin_ptr); + VTR_ASSERT(fanin_ptr); return (in_cycle(ntk, obj_id_to_find, fanin_ptr, flag)); } diff --git a/ace2/SRC/io_ace.c b/ace2/SRC/io_ace.c index 4d7bfe812..947e31644 100644 --- a/ace2/SRC/io_ace.c +++ b/ace2/SRC/io_ace.c @@ -1,5 +1,7 @@ #include +#include "vtr_assert.h" + #include "ace.h" #include "io_ace.h" @@ -34,7 +36,7 @@ void ace_io_print_activity(Abc_Ntk_t * ntk, FILE * fp) { Abc_NtkForEachObj(ntk, obj, i) { - assert(obj->pCopy); + VTR_ASSERT(obj->pCopy); obj_new = obj->pCopy; Ace_Obj_Info_t * info = Ace_ObjInfo(obj); @@ -69,7 +71,7 @@ void ace_io_print_activity(Abc_Ntk_t * ntk, FILE * fp) { default: //printf("Unkown Type: %d\n", Abc_ObjType(obj)); - //assert(0); + //VTR_ASSERT(0); break; } @@ -235,10 +237,10 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, printf("Cannot open input file\n"); error = ACE_ERROR; } else { - assert(p >= 0.0 && p <= 1.0); - assert(d >= 0.0 && d <= 1.0); - assert(d <= 2.0 * p); - assert(d <= 2.0 * (1.0 - p)); + VTR_ASSERT(p >= 0.0 && p <= 1.0); + VTR_ASSERT(d >= 0.0 && d <= 1.0); + VTR_ASSERT(d <= 2.0 * p); + VTR_ASSERT(d <= 2.0 * (1.0 - p)); Abc_NtkForEachPi(ntk, obj_ptr, i) { @@ -269,7 +271,7 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, // Read real PIs activity values from file res = fgets(line, ACE_CHAR_BUFFER_SIZE, in_file_desc); - assert(res); + VTR_ASSERT(res); while (!feof(in_file_desc)) { sscanf(line, "%s %lf %lf\n", pi_name, &static_prob, &switch_prob); @@ -283,8 +285,8 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, } pi_obj_ptr = Abc_NtkObj(ntk, pi_obj_id); - assert(static_prob >= 0.0 && static_prob <= 1.0); - assert(switch_prob >= 0.0 && switch_prob <= 1.0); + VTR_ASSERT(static_prob >= 0.0 && static_prob <= 1.0); + VTR_ASSERT(switch_prob >= 0.0 && switch_prob <= 1.0); info = Ace_ObjInfo(pi_obj_ptr); info->static_prob = static_prob; @@ -292,7 +294,7 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, info->switch_act = switch_prob; res = fgets(line, ACE_CHAR_BUFFER_SIZE, in_file_desc); - assert(res); + VTR_ASSERT(res); } } else if (pi_format == ACE_VEC) { printf("Reading vector file...\n"); @@ -305,10 +307,10 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, char* res; res = fgets(line, ACE_CHAR_BUFFER_SIZE, in_file_desc); - assert(res); + VTR_ASSERT(res); while (!feof(in_file_desc)) { res = fgets(line, ACE_CHAR_BUFFER_SIZE, in_file_desc); - assert(res); + VTR_ASSERT(res); num_vec++; } Abc_NtkForEachPi(ntk, obj_ptr, i) @@ -325,7 +327,7 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, num_vec = 0; res = fgets(line, ACE_CHAR_BUFFER_SIZE, in_file_desc); - assert(res); + VTR_ASSERT(res); while (!feof(in_file_desc)) { sscanf(line, "%s\n", vector); @@ -336,7 +338,7 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, error = ACE_ERROR; break; } - assert(strlen(vector) == num_Pi); + VTR_ASSERT(strlen(vector) == num_Pi); if (num_vec == 0) { Abc_NtkForEachPi(ntk, obj_ptr, i) @@ -364,14 +366,14 @@ int ace_io_read_activity(Abc_Ntk_t * ntk, FILE * in_file_desc, } res = fgets(line, ACE_CHAR_BUFFER_SIZE, in_file_desc); - assert(res); + VTR_ASSERT(res); num_vec++; } if (!error) { Abc_NtkForEachPi(ntk, obj_ptr, i) { - assert(num_vec > 0); + VTR_ASSERT(num_vec > 0); info = Ace_ObjInfo(obj_ptr); info->static_prob = (double) high[i] / (double) num_vec; diff --git a/ace2/SRC/sim.c b/ace2/SRC/sim.c index ccc711203..361e2804f 100644 --- a/ace2/SRC/sim.c +++ b/ace2/SRC/sim.c @@ -1,3 +1,4 @@ +#include "vtr_assert.h" #include "ace.h" #include "sim.h" @@ -60,7 +61,7 @@ void get_pi_values(Abc_Ntk_t * ntk, Vec_Ptr_t * /*nodes*/, int cycle) { default: printf("Bad Value\n"); - assert(0); + VTR_ASSERT(0); break; } } @@ -111,7 +112,7 @@ void get_pi_values(Abc_Ntk_t * ntk, Vec_Ptr_t * /*nodes*/, int cycle) { default: printf("Bad value\n"); - assert(FALSE); + VTR_ASSERT(FALSE); break; } } @@ -131,7 +132,7 @@ int * getFaninValues(Abc_Obj_t * obj_ptr) { info = Ace_ObjInfo(fanin); if (info->status == ACE_UNDEF) { printf("Fan-in is undefined\n"); - assert(FALSE); + VTR_ASSERT(FALSE); } else if (info->status == ACE_NEW) { break; } @@ -210,15 +211,15 @@ void evaluate_circuit(Abc_Ntk_t * ntk, Vec_Ptr_t * node_vec, int /*cycle*/) { case ACE_NEW: if (Abc_ObjIsNode(obj)) { faninValues = getFaninValues(obj); - assert(faninValues); + VTR_ASSERT(faninValues); dd_node = Cudd_Eval((DdManager*) ntk->pManFunc, (DdNode*) obj->pData, faninValues); - assert(Cudd_IsConstant(dd_node)); + VTR_ASSERT(Cudd_IsConstant(dd_node)); if (dd_node == Cudd_ReadOne((DdManager*) ntk->pManFunc)) { value = 1; } else if (dd_node == Cudd_ReadLogicZero((DdManager*) ntk->pManFunc)) { value = 0; } else { - assert(0); + VTR_ASSERT(0); } free(faninValues); } else { @@ -240,12 +241,12 @@ void evaluate_circuit(Abc_Ntk_t * ntk, Vec_Ptr_t * node_vec, int /*cycle*/) { info->num_ones += info->value; break; default: - assert(0); + VTR_ASSERT(0); break; } break; default: - assert(0); + VTR_ASSERT(0); break; } } @@ -294,8 +295,8 @@ void ace_sim_activities(Abc_Ntk_t * ntk, Vec_Ptr_t * nodes, int max_cycles, Ace_Obj_Info_t * info; int i; - assert(max_cycles > 0); - assert(threshold > 0.0); + VTR_ASSERT(max_cycles > 0); + VTR_ASSERT(threshold > 0.0); // srand((unsigned) time(NULL)); @@ -326,12 +327,12 @@ void ace_sim_activities(Abc_Ntk_t * ntk, Vec_Ptr_t * nodes, int max_cycles, { info = Ace_ObjInfo(obj); info->static_prob = info->num_ones / (double) max_cycles; - assert(info->static_prob >= 0.0 && info->static_prob <= 1.0); + VTR_ASSERT(info->static_prob >= 0.0 && info->static_prob <= 1.0); info->switch_prob = info->num_toggles / (double) max_cycles; - assert(info->switch_prob >= 0.0 && info->switch_prob <= 1.0); + VTR_ASSERT(info->switch_prob >= 0.0 && info->switch_prob <= 1.0); - assert(info->switch_prob - EPSILON <= 2.0 * (1.0 - info->static_prob)); - assert(info->switch_prob - EPSILON <= 2.0 * (info->static_prob)); + VTR_ASSERT(info->switch_prob - EPSILON <= 2.0 * (1.0 - info->static_prob)); + VTR_ASSERT(info->switch_prob - EPSILON <= 2.0 * (info->static_prob)); info->status = ACE_SIM; } diff --git a/compilation/dependencies.md b/compilation/dependencies.md deleted file mode 100644 index 914b18bc2..000000000 --- a/compilation/dependencies.md +++ /dev/null @@ -1,15 +0,0 @@ -Yosys -========= - -*Information taken from Yosys' GitHub* -You need a C++ compiler with C++11 support (up-to-date CLANG or GCC is recommended) and some standard tools such as GNU Flex, GNU Bison, and GNU Make. TCL, readline and libffi are optional (see ENABLE_* settings in Makefile). Xdot (graphviz) is used by the show command in yosys to display schematics. - -ABC -========= - -ABC depends on gcc-4.9. It is precisely this version which is required. If another gcc is used, the compilation will not be finished correctly. - -ACE2 -========= - -ACE2 only needs a compiler to work. Gcc is the one chosen in this case. No issue was ever reported with ACE2 so if you have one, raise an issue so that we can modify it here. diff --git a/compilation/macos_compilation.md b/compilation/macos_compilation.md deleted file mode 100644 index c5de47da7..000000000 --- a/compilation/macos_compilation.md +++ /dev/null @@ -1,40 +0,0 @@ -MacOS compilation -================== - -*This tutorial has been tested under MacOS High Sierra 10.13.4* - -Clone the [OpenFPGA git repository:](https://github.com/LNIS-Projects/OpenFPGA) - -`git clone --recurse-submodules https://github.com/LNIS-Projects/OpenFPGA.git ` - -[//todo]: # (There is a submodule in the repository so move to the OpenFPGA directory and clone that too:) - -[//]: # (`git submodule init`) - -[//todo]: # (`git submodule update`) - -Go to the `VPR` directory and build the tool: - -`cd ./OpenFPGA/vpr7_x2p/vpr/` - -Note: the graphical interface might not be usable since it requires the X11 library. In this case, open the Makefile and change the line 10 "ENABLE_GRAPHICS = true" to false. - -`make ` - -This will generate vpr and a libvpr.a file. - -Enhancements of VPR were made. -In order to see them just type: - -`./vpr` - -This will show the different options that can be used. Our modifications concern the options starting with fpga_spice and fpga_verilog. - -A script is already prepared in the folder to test FPGA-SPICE and FPGA-Verilog - -`source ./go_fpga_verilog.sh` - -This script uses the enhanced version of vpr with some new options such as --fpga_verilog_print_top_testbench which automatically generates a testbench for the full FPGA and --fpga_verilog_dir which allows us to choose the destination directory for the verilog output we generate. -For more informations on how the new commands work, please visit [OpenFPGA Options FPGA-SPICE](https://openfpga.readthedocs.io/en/latest/fpga_spice/command_line_usage.html). - -As a result, we get a new folder, /verilog_test, which contains the verilog code. The name_top.v contains the full FPGA we just created. Three other folders are created, *lb*, *routing* and *sub_modules*. *lb* contains the different CLBs used in the architecture. *routing* contains the different connection blocks, the switch boxes and the wires. *sub_modules* contains the different modules needed in the architecture. diff --git a/compilation/red_hat_compilation.md b/compilation/red_hat_compilation.md deleted file mode 100644 index 2fc0c14fd..000000000 --- a/compilation/red_hat_compilation.md +++ /dev/null @@ -1,40 +0,0 @@ -Red Hat compilation -================== - -*This tutorial has been tested under Red Hat 7.5* - -Clone the [OpenFPGA git repository:](https://github.com/LNIS-Projects/OpenFPGA) - -`git clone --recurse-submodules https://github.com/LNIS-Projects/OpenFPGA.git ` - -[//todo]: # (There is a submodule in the repository so move to the OpenFPGA directory and clone that too:) - -[//]: # (`git submodule init`) - -[//todo]: # (`git submodule update`) - -Go to the `VPR` directory and build the tool: - -`cd ./OpenFPGA/vpr7_x2p/vpr/` - -Note: the graphical interface might not be usable since it requires the X11 library. In this case, open the Makefile and change the line 10 "ENABLE_GRAPHICS = true" to false. - -`make ` - -This will generate vpr and a libvpr.a file. - -Enhancements of VPR were made. -In order to see them just type: - -`./vpr` - -This will show the different options that can be used. Our modifications concern the options starting with fpga_spice and fpga_verilog. - -A script is already prepared in the folder to test FPGA-SPICE and FPGA-Verilog - -`source ./go_fpga_verilog.sh` - -This script uses the enhanced version of vpr with some new options such as --fpga_verilog_print_top_testbench which automatically generates a testbench for the full FPGA and --fpga_verilog_dir which allows us to choose the destination directory for the verilog output we generate. -For more informations on how the new commands work, please visit [OpenFPGA Options FPGA-SPICE](https://openfpga.readthedocs.io/en/latest/fpga_spice/command_line_usage.html). - -As a result, we get a new folder, /verilog_test, which contains the verilog code. The name_top.v contains the full FPGA we just created. Three other folders are created, *lb*, *routing* and *sub_modules*. *lb* contains the different CLBs used in the architecture. *routing* contains the different connection blocks, the switch boxes and the wires. *sub_modules* contains the different modules needed in the architecture. diff --git a/compilation/ubuntu_compilation.md b/compilation/ubuntu_compilation.md deleted file mode 100644 index 63bb79ca3..000000000 --- a/compilation/ubuntu_compilation.md +++ /dev/null @@ -1,37 +0,0 @@ -Ubuntu compilation -================== - -*This tutorial has been tested under Ubuntu 18.04* - -Clone the [OpenFPGA git repository:](https://github.com/LNIS-Projects/OpenFPGA) - -`git clone --recurse-submodules https://github.com/LNIS-Projects/OpenFPGA.git ` - -[//todo]: # (There is a submodule in the repository so move to the OpenFPGA directory and clone that too:) - -[//]: # (`git submodule init`) - -[//todo]: # (`git submodule update`) - -Go to the `VPR` directory and build the tool: - -`cd ./OpenFPGA/vpr7_x2p/vpr/` -`make ` - -This will generate vpr and a libvpr.a file. - -Enhancements of VPR were made. -In order to see them just type: - -`./vpr` - -This will show the different options that can be used. Our modifications concern the options starting with fpga_spice and fpga_verilog. - -A script is already prepared in the folder to test FPGA-SPICE and FPGA-Verilog - -`source ./go_fpga_verilog.sh` - -This script uses the enhanced version of vpr with some new options such as --fpga_verilog_print_top_testbench which automatically generates a testbench for the full FPGA and --fpga_verilog_dir which allows us to choose the destination directory for the verilog output we generate. -For more informations on how the new commands work, please visit [OpenFPGA Options FPGA-SPICE](https://openfpga.readthedocs.io/en/latest/fpga_spice/command_line_usage.html). - -As a result, we get a new folder, /verilog_test, which contains the verilog code. The name_top.v contains the full FPGA we just created. Three other folders are created, *lb*, *routing* and *sub_modules*. *lb* contains the different CLBs used in the architecture. *routing* contains the different connection blocks, the switch boxes and the wires. *sub_modules* contains the different modules needed in the architecture. diff --git a/fpga_flow/arch/template/k6_N10_sram_chain_HC_template.xml b/fpga_flow/arch/template/k6_N10_sram_chain_HC_template.xml index c4642ed55..ab5e95413 100644 --- a/fpga_flow/arch/template/k6_N10_sram_chain_HC_template.xml +++ b/fpga_flow/arch/template/k6_N10_sram_chain_HC_template.xml @@ -397,7 +397,7 @@ - + diff --git a/fpga_flow/tuto_fpga_flow.sh b/fpga_flow/tuto_fpga_flow.sh index 72cae371a..7d70423cd 100755 --- a/fpga_flow/tuto_fpga_flow.sh +++ b/fpga_flow/tuto_fpga_flow.sh @@ -18,7 +18,7 @@ dir_keyword="GENERATED_DIR_KEYWORD" rm -rf ${pwd_path}/results_OpenPithon cd ${pwd_path}/arch -mkdir generated # create folder to save rewritten architecture +mkdir -p generated # create folder to save rewritten architecture cd ${pwd_path}/scripts # Replace keyword in config and architecture files diff --git a/tutorials/fpga_flow/how2use.md b/tutorials/fpga_flow/how2use.md index ab0a3f9f5..0bbe343a0 100644 --- a/tutorials/fpga_flow/how2use.md +++ b/tutorials/fpga_flow/how2use.md @@ -93,4 +93,4 @@ Once dependancies are understood, we can modify the flow by changing the archite ### Explanation -With this last experiment we replace the [**K6 architecture**](https://github.com/LNIS-Projects/OpenFPGA/blob/master/tutorials/image/architectures_schematics/frac_lut6.pdf) with a [**K8 architecture**](https://github.com/LNIS-Projects/OpenFPGA/blob/master/tutorials/image/architectures_schematics/frac_lut8.pdf), which means a 8-inputs fracturable LUT (implemented by LUT6 and LUT4 with 2 shared inputs). This architecture provides more modes for the CLB and the crossbar changed from a half-connected to a fully connected, implying bigger multiplexor between the CLB and LUT inputs. These requirement in term of interconnection will lead to the increase in routing channel width. Indeed, if the routing channel is to low, it could be impossible to route a benchmark or the FPGA output can be delayed. +With this last experiment we replace the [**K6 architecture**](https://github.com/LNIS-Projects/OpenFPGA/blob/master/tutorials/images/architectures_schematics/frac_lut6.pdf) with a [**K8 architecture**](https://github.com/LNIS-Projects/OpenFPGA/blob/master/tutorials/images/architectures_schematics/frac_lut8.pdf), which means a 8-inputs fracturable LUT (implemented by LUT6 and LUT4 with 2 shared inputs). This architecture provides more modes for the CLB and the crossbar changed from a half-connected to a fully connected, implying bigger multiplexor between the CLB and LUT inputs. These requirement in term of interconnection will lead to the increase in routing channel width. Indeed, if the routing channel is to low, it could be impossible to route a benchmark or the FPGA output can be delayed. diff --git a/vpr7_x2p/vpr/ARCH/k6_N10_sram_chain_SC_gf130_2x2.xml b/vpr7_x2p/vpr/ARCH/k6_N10_sram_chain_SC_gf130_2x2.xml index fb5192145..426bcdcf6 100755 --- a/vpr7_x2p/vpr/ARCH/k6_N10_sram_chain_SC_gf130_2x2.xml +++ b/vpr7_x2p/vpr/ARCH/k6_N10_sram_chain_SC_gf130_2x2.xml @@ -273,7 +273,7 @@ - + @@ -300,7 +300,7 @@ - + @@ -515,7 +515,7 @@ - + @@ -632,16 +632,16 @@ - - - + + + - + @@ -650,7 +650,7 @@ - + @@ -660,7 +660,7 @@ - + @@ -696,12 +696,12 @@ - - - + + + - + @@ -732,7 +732,7 @@ - + @@ -750,13 +750,13 @@ - + - + @@ -769,7 +769,7 @@ - + @@ -795,9 +795,9 @@ - - - + + + @@ -805,7 +805,7 @@ - + @@ -815,7 +815,7 @@ - + @@ -833,7 +833,7 @@ - + input ports */ dump_verilog_pb_type_bus_ports(fp, port_prefix, 1, prim_pb_type, FALSE, FALSE, subckt_require_explicit_port_map); + /* my_bool_to_boolean(is_explicit_mapping));*/ /* IOPADs requires a specical port to output */ if (SPICE_MODEL_IOPAD == verilog_model->type) { fprintf(fp, ",\n"); assert(1 == num_pad_port); assert(NULL != pad_ports[0]); /* Add explicit port mapping if required */ - if (TRUE == subckt_require_explicit_port_map) { - fprintf(fp, ".%s(", + if (TRUE == subckt_require_explicit_port_map) { + /*if (true == is_explicit_mapping) {*/ + fprintf(fp, ".%s (", pad_ports[0]->lib_name); } /* Print inout port */ fprintf(fp, "%s%s[%d]", gio_inout_prefix, verilog_model->prefix, verilog_model->cnt); - if (TRUE == subckt_require_explicit_port_map) { + if (TRUE == subckt_require_explicit_port_map) { + /*if (true == is_explicit_mapping) {*/ fprintf(fp, ")"); } fprintf(fp, ", "); @@ -273,7 +276,7 @@ void dump_verilog_pb_generic_primitive(t_sram_orgz_info* cur_sram_orgz_info, && (TRUE == subckt_require_explicit_port_map)) { assert( 1 == num_sram_port); assert( NULL != sram_ports[0]); - fprintf(fp, ".%s(", + fprintf(fp, ".%s (", sram_ports[0]->lib_name); } dump_verilog_sram_one_local_outport(fp, cur_sram_orgz_info, @@ -294,14 +297,14 @@ void dump_verilog_pb_generic_primitive(t_sram_orgz_info* cur_sram_orgz_info, && (TRUE == subckt_require_explicit_port_map)) { assert( 1 == num_sram_port); assert( NULL != sram_ports[0]); - fprintf(fp, ".%s(", + fprintf(fp, ".%s (", sram_ports[0]->inv_prefix); } dump_verilog_sram_one_local_outport(fp, cur_sram_orgz_info, cur_num_sram, cur_num_sram + num_sram - 1, 1, VERILOG_PORT_CONKT); if ( (0 < num_sram) - && (TRUE == verilog_model->dump_explicit_port_map || is_explicit_mapping)) { + && (TRUE == subckt_require_explicit_port_map)) { fprintf(fp, ")"); } break; @@ -311,7 +314,7 @@ void dump_verilog_pb_generic_primitive(t_sram_orgz_info* cur_sram_orgz_info, && (TRUE == subckt_require_explicit_port_map)) { assert( 1 == num_sram_port); assert( NULL != sram_ports[0]); - fprintf(fp, ".%s(", + fprintf(fp, ".%s (", sram_ports[0]->lib_name); } dump_verilog_sram_one_outport(fp, cur_sram_orgz_info, @@ -331,7 +334,7 @@ void dump_verilog_pb_generic_primitive(t_sram_orgz_info* cur_sram_orgz_info, && (TRUE == subckt_require_explicit_port_map)) { assert( 1 == num_sram_port); assert( NULL != sram_ports[0]); - fprintf(fp, ".%s(", + fprintf(fp, ".%s (", sram_ports[0]->inv_prefix); } dump_verilog_sram_one_outport(fp, cur_sram_orgz_info, diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_report_timing.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_report_timing.c index 87487220c..656d0b26d 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_report_timing.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_report_timing.c @@ -2740,6 +2740,9 @@ void verilog_generate_routing_wire_report_timing(t_trpt_opts trpt_opts, vpr_printf(TIO_MESSAGE_INFO, "Generating TCL script to report timing for routing wires\n"); + vpr_printf(TIO_MESSAGE_INFO, + "Generating TCL script to report timing for routing wires horizontal\n"); + /* Start with horizontal SBs*/ /* We start from a SB[x][y] */ DeviceCoordinator sb_range = device_rr_gsb.get_gsb_range(); for (size_t ix = 0; ix < sb_range.get_x(); ++ix) { @@ -2759,6 +2762,9 @@ void verilog_generate_routing_wire_report_timing(t_trpt_opts trpt_opts, if (1 == rr_sb.get_chan_node(side_manager.get_side(), itrack)->num_drive_rr_nodes) { continue; } + if (CHANY == rr_sb.get_chan_node(side_manager.get_side(), itrack)->type) { + continue; + } /* Check if L_wire exists in the linked list */ L_wire = get_rr_node_wire_length(rr_sb.get_chan_node(side_manager.get_side(), itrack)); /* Get counter */ @@ -2793,6 +2799,72 @@ void verilog_generate_routing_wire_report_timing(t_trpt_opts trpt_opts, } } + /* close file*/ + fclose_wire_L_file_handler_in_llist(rr_path_cnt); + /* Need to reset the different variables */ + rr_path_cnt = NULL; + wireL_cnt = NULL; + path_cnt = 0; + + vpr_printf(TIO_MESSAGE_INFO, + "Generating TCL script to report timing for routing wires vertical\n"); + /* Continue with vertical SBs*/ + /* We start from a SB[x][y] */ + for (size_t ix = 0; ix < sb_range.get_x(); ++ix) { + for (size_t iy = 0; iy < sb_range.get_y(); ++iy) { + const RRGSB& rr_sb = device_rr_gsb.get_gsb(ix, iy); + for (size_t side = 0; side < rr_sb.get_num_sides(); ++side) { + Side side_manager(side); + for (size_t itrack = 0; itrack < rr_sb.get_chan_width(side_manager.get_side()); ++itrack) { + assert((CHANX == rr_sb.get_chan_node(side_manager.get_side(), itrack)->type) + ||(CHANY == rr_sb.get_chan_node(side_manager.get_side(), itrack)->type)); + /* We only care the output port and it should indicate a SB mux */ + if ( (OUT_PORT != rr_sb.get_chan_node_direction(side_manager.get_side(), itrack)) + || (false != rr_sb.is_sb_node_passing_wire(side_manager.get_side(), itrack))) { + continue; + } + /* Bypass if we have only 1 driving node */ + if (1 == rr_sb.get_chan_node(side_manager.get_side(), itrack)->num_drive_rr_nodes) { + continue; + } + if (CHANX == rr_sb.get_chan_node(side_manager.get_side(), itrack)->type) { + continue; + } + /* Check if L_wire exists in the linked list */ + L_wire = get_rr_node_wire_length(rr_sb.get_chan_node(side_manager.get_side(), itrack)); + /* Get counter */ + rr_path_cnt = get_wire_L_counter_in_llist(rr_path_cnt, trpt_opts, "vertical", L_wire, &wireL_cnt); + path_cnt = wireL_cnt->cnt; + fp = wireL_cnt->file_handler; + /* This is a new L-wire, create the file handler and the mkdir command to the TCL script */ + if (0 == path_cnt) { + fprintf(fp, "exec mkdir -p %s\n", + gen_verilog_one_routing_report_timing_Lwire_dir_path(fpga_verilog_opts.report_timing_path, L_wire)); + } + /* Restore the disable_timing for the SB outputs on the path */ + /*fprintf(fp, "# Restore disable timing for the following Switch Block output:\n"); + restore_disable_timing_one_sb_output(fp, + rr_sb, + rr_sb.get_chan_node(side_manager.get_side(), itrack));*/ + fprintf(fp, "# Report timing for all the paths using this output:\n"); + /* Dump report_timing command */ + verilog_generate_one_routing_segmental_report_timing(fp, fpga_verilog_opts, + rr_sb, + side_manager.get_side(), itrack, + LL_rr_node, "vertical", &path_cnt); + /* Disable the timing again */ + /*fprintf(fp, "# Set disable timing for the following Switch Block output:\n"); + set_disable_timing_one_sb_output(fp, + rr_sb, + rr_sb.get_chan_node(side_manager.get_side(), itrack));*/ + /* Update the wire L*/ + update_wire_L_counter_in_llist(rr_path_cnt, L_wire, path_cnt); + } + } + } + } + + /* close file*/ fclose_wire_L_file_handler_in_llist(rr_path_cnt); diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_routing.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_routing.c index 9d3431585..aa4525e9a 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_routing.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_routing.c @@ -981,6 +981,7 @@ void dump_verilog_unique_switch_box_mux(t_sram_orgz_info* cur_sram_orgz_info, int cur_bl, cur_wl; t_spice_model* mem_model = NULL; char* mem_subckt_name = NULL; + int num_input_port, num_output_port, num_sram_port; /* Check the file handler*/ if (NULL == fp) { @@ -1096,8 +1097,11 @@ void dump_verilog_unique_switch_box_mux(t_sram_orgz_info* cur_sram_orgz_info, fprintf(fp, ",\n"); } + t_spice_model_port** input_port = find_spice_model_ports(verilog_model, SPICE_MODEL_PORT_INPUT, &num_input_port, TRUE); + t_spice_model_port** output_port = find_spice_model_ports(verilog_model, SPICE_MODEL_PORT_OUTPUT, &num_output_port, TRUE); if (TRUE == is_explicit_mapping) { - fprintf(fp, ".in("); + fprintf(fp, ".%s(", + input_port[0]->prefix); fprintf(fp, "%s_size%d_%d_inbus), ", verilog_model->prefix, mux_size, verilog_model->cnt); } @@ -1107,7 +1111,8 @@ void dump_verilog_unique_switch_box_mux(t_sram_orgz_info* cur_sram_orgz_info, } /* Output port */ if (TRUE == is_explicit_mapping) { - fprintf(fp, ".out("); + fprintf(fp, ".%s(", + output_port[0]->prefix); dump_verilog_unique_switch_box_chan_port(fp, rr_sb, chan_side, cur_rr_node, OUT_PORT); fprintf(fp, ")"); } @@ -1453,6 +1458,10 @@ void dump_verilog_unique_switch_box_interc(t_sram_orgz_info* cur_sram_orgz_info, } else { num_drive_rr_nodes = cur_rr_node->num_drive_rr_nodes; drive_rr_nodes = cur_rr_node->drive_rr_nodes; + /* Special: if there are zero-driver nodes. We skip here */ + if (0 == num_drive_rr_nodes) { + return; + } } if (0 == num_drive_rr_nodes) { diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_sdc.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_sdc.c index 345c89954..b70163422 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_sdc.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_sdc.c @@ -2732,12 +2732,13 @@ void verilog_generate_sdc_pnr(t_sram_orgz_info* cur_sram_orgz_info, } /* Part 5. Output routing constraints for Connection Blocks */ - if (TRUE == sdc_opts.constrain_routing_channels) { + /* BC: Might not be useful as it constrains nets which are assigned too*/ + /*if (TRUE == sdc_opts.constrain_routing_channels) { verilog_generate_sdc_constrain_routing_channels(sdc_opts, arch, LL_nx, LL_ny, LL_num_rr_nodes, LL_rr_node, LL_rr_node_indices, LL_rr_indexed_data); - } + }*/ /* Part 6. Output routing constraints for Programmable blocks */ if (TRUE == sdc_opts.constrain_pbs) { diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c index e0f09aebd..79a794729 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c @@ -722,8 +722,10 @@ void dump_verilog_cmos_mux_one_basis_module_structural(FILE* fp, t_spice_model* tgate_spice_model = cur_spice_model->pass_gate_logic->spice_model; int num_input_port = 0; int num_output_port = 0; + int num_sram_port = 0; t_spice_model_port** input_port = NULL; t_spice_model_port** output_port = NULL; + t_spice_model_port** sram_port = NULL; assert(TRUE == cur_spice_model->dump_structural_verilog); @@ -737,6 +739,7 @@ void dump_verilog_cmos_mux_one_basis_module_structural(FILE* fp, assert ( NULL != tgate_spice_model); input_port = find_spice_model_ports(tgate_spice_model, SPICE_MODEL_PORT_INPUT, &num_input_port, TRUE); output_port = find_spice_model_ports(tgate_spice_model, SPICE_MODEL_PORT_OUTPUT, &num_output_port, TRUE); + sram_port = find_spice_model_ports(tgate_spice_model, SPICE_MODEL_PORT_SRAM, &num_sram_port, TRUE); /* Check */ assert ((3 == num_input_port)); @@ -764,9 +767,9 @@ void dump_verilog_cmos_mux_one_basis_module_structural(FILE* fp, fprintf(fp, "input [0:%d] in,\n", num_input_basis_subckt - 1); fprintf(fp, "output out,\n"); fprintf(fp, "input [0:%d] mem,\n", - num_mem - 1); + num_mem - 1/*, sram_port[0]->prefix*/); fprintf(fp, "input [0:%d] mem_inv);\n", - num_mem - 1); + num_mem - 1/*, sram_port[0]->prefix*/); /* Verilog Behavior description for a MUX */ fprintf(fp, "//---- Structure-level description -----\n"); /* Special case: only one memory, switch case is simpler @@ -1678,7 +1681,8 @@ void dump_verilog_cmos_mux_submodule(FILE* fp, switch (cur_mux_structure) { case SPICE_MODEL_STRUCTURE_TREE: dump_verilog_cmos_mux_tree_structure(fp, mux_basis_subckt_name, - spice_model, spice_mux_arch, num_sram_port, sram_port, is_explicit_mapping); + spice_model, spice_mux_arch, + num_sram_port, sram_port, is_explicit_mapping); break; case SPICE_MODEL_STRUCTURE_ONELEVEL: dump_verilog_cmos_mux_onelevel_structure(fp, mux_basis_subckt_name, diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.c index 16e31390c..fc8e5a206 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.c @@ -1069,7 +1069,8 @@ void dump_verilog_configuration_circuits_standalone_srams(t_sram_orgz_info* cur_ */ static void dump_verilog_configuration_circuits_scan_chains(t_sram_orgz_info* cur_sram_orgz_info, - FILE* fp) { + FILE* fp, + bool is_explicit_mapping) { int num_mem_bits = 0; /* Check */ @@ -1088,12 +1089,31 @@ void dump_verilog_configuration_circuits_scan_chains(t_sram_orgz_info* cur_sram_ verilog_config_peripheral_prefix, verilog_config_peripheral_prefix); /* Scan-chain input*/ + if (true == is_explicit_mapping) { + fprintf(fp, ".%s (", + top_netlist_scan_chain_head_prefix); + } dump_verilog_generic_port(fp, VERILOG_PORT_CONKT, top_netlist_scan_chain_head_prefix, 0, 0); + if (true == is_explicit_mapping) { + fprintf(fp, ")"); + } fprintf(fp, ",\n"); + if (true == is_explicit_mapping) { + fprintf(fp, ".scff_scff_in_local_bus ("); + } dump_verilog_sram_one_local_outport(fp, cur_sram_orgz_info, 0, num_mem_bits - 1, -1, VERILOG_PORT_CONKT); + if (true == is_explicit_mapping) { + fprintf(fp, ")"); + } fprintf(fp, ",\n"); + if (true == is_explicit_mapping) { + fprintf(fp, ".scff_scff_out_local_bus ("); + } dump_verilog_sram_one_local_outport(fp, cur_sram_orgz_info, 0, num_mem_bits - 1, 0, VERILOG_PORT_CONKT); + if (true == is_explicit_mapping) { + fprintf(fp, ")"); + } fprintf(fp, ");\n"); fprintf(fp, "//------ END Configuration peripheral Scan-chain FFs -----\n"); @@ -1103,7 +1123,8 @@ void dump_verilog_configuration_circuits_scan_chains(t_sram_orgz_info* cur_sram_ /* Dump a memory bank to configure all the Bit lines and Word lines */ static void dump_verilog_configuration_circuits_memory_bank(FILE* fp, - t_sram_orgz_info* cur_sram_orgz_info) { + t_sram_orgz_info* cur_sram_orgz_info, + bool is_explicit_mapping) { int num_bl, num_wl; int num_reserved_bl, num_reserved_wl; int num_array_bl, num_array_wl; @@ -1210,16 +1231,18 @@ void dump_verilog_configuration_circuits_memory_bank(FILE* fp, * 3. Standalone SRAMs */ void dump_verilog_configuration_circuits(t_sram_orgz_info* cur_sram_orgz_info, - FILE* fp) { + FILE* fp, + bool is_explicit_mapping) { switch(cur_sram_orgz_info->type) { case SPICE_SRAM_STANDALONE: dump_verilog_configuration_circuits_standalone_srams(cur_sram_orgz_info, fp); break; case SPICE_SRAM_SCAN_CHAIN: - dump_verilog_configuration_circuits_scan_chains(cur_sram_orgz_info, fp); + dump_verilog_configuration_circuits_scan_chains(cur_sram_orgz_info, fp, is_explicit_mapping); break; case SPICE_SRAM_MEMORY_BANK: - dump_verilog_configuration_circuits_memory_bank(fp, cur_sram_orgz_info); + /* BC: TODO explicit_mapping*/ + dump_verilog_configuration_circuits_memory_bank(fp, cur_sram_orgz_info, is_explicit_mapping); break; default: vpr_printf(TIO_MESSAGE_ERROR,"(File:%s,[LINE%d])Invalid type of SRAM organization in Verilog Generator!\n", diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.h b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.h index c57d7694f..a556a189a 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.h +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_top_netlist_utils.h @@ -24,7 +24,8 @@ void dump_verilog_clb2clb_directs(FILE* fp, int num_directs, t_clb_to_clb_directs* direct); void dump_verilog_configuration_circuits(t_sram_orgz_info* cur_sram_orgz_info, - FILE* fp); + FILE* fp, + bool is_explicit_mapping); void dump_verilog_top_module_ports(t_sram_orgz_info* cur_sram_orgz_info, FILE* fp, diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_utils.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_utils.c index eef883b00..67a31e10f 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_utils.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_utils.c @@ -902,8 +902,8 @@ int rec_dump_verilog_spice_model_global_ports(FILE* fp, /* Add explicit port mapping if required */ if (TRUE == require_explicit_port_map ) { fprintf(fp, ".%s(", - cur_spice_model_port->lib_name); - /*cur_spice_model_port->prefix);*/ + cur_spice_model_port->lib_name); + //cur_spice_model_port->prefix); } fprintf(fp, "%s[0:%d]", cur_spice_model_port->prefix, @@ -2575,6 +2575,8 @@ void dump_verilog_cmos_mux_config_bus_ports(FILE* fp, t_spice_model* mux_spice_m int num_mux_reserved_conf_bits, int num_mux_conf_bits, bool is_explicit_mapping) { + int num_sram_port; + t_spice_model_port** sram_port = find_spice_model_ports(mux_spice_model, SPICE_MODEL_PORT_SRAM, &num_sram_port, TRUE); /* Check the file handler*/ if (NULL == fp) { vpr_printf(TIO_MESSAGE_ERROR,"(File:%s,[LINE%d])Invalid file handler.\n", @@ -2595,7 +2597,8 @@ void dump_verilog_cmos_mux_config_bus_ports(FILE* fp, t_spice_model* mux_spice_m * We do not need a prefix implying MUX name, size and index */ if (true == is_explicit_mapping) { - fprintf(fp, ".sram("); + fprintf(fp, ".%s (", + sram_port[0]->prefix); } dump_verilog_mux_sram_one_outport(fp, cur_sram_orgz_info, mux_spice_model, mux_size, @@ -2607,7 +2610,8 @@ void dump_verilog_cmos_mux_config_bus_ports(FILE* fp, t_spice_model* mux_spice_m } fprintf(fp, ", "); if (TRUE == is_explicit_mapping) { - fprintf(fp, ".sram_inv("); + fprintf(fp, ".%s_inv (", + sram_port[0]->prefix); } dump_verilog_mux_sram_one_outport(fp, cur_sram_orgz_info, mux_spice_model, mux_size, @@ -2624,7 +2628,8 @@ void dump_verilog_cmos_mux_config_bus_ports(FILE* fp, t_spice_model* mux_spice_m * We need a prefix implying MUX name, size and index */ if (TRUE == is_explicit_mapping) { - fprintf(fp, ".sram("); + fprintf(fp, ".%s (", + sram_port[0]->prefix); } dump_verilog_mux_sram_one_outport(fp, cur_sram_orgz_info, mux_spice_model, mux_size, @@ -2636,7 +2641,8 @@ void dump_verilog_cmos_mux_config_bus_ports(FILE* fp, t_spice_model* mux_spice_m } fprintf(fp, ",\n"); if (TRUE == is_explicit_mapping) { - fprintf(fp, ".sram_inv("); + fprintf(fp, ".%s_inv (", + sram_port[0]->prefix); } dump_verilog_mux_sram_one_outport(fp, cur_sram_orgz_info, mux_spice_model, mux_size, @@ -3102,6 +3108,7 @@ void dump_verilog_mem_sram_submodule(FILE* fp, int num_bl_per_sram = 0; int num_wl_per_sram = 0; int iport = 0; + t_llist* spice_model_head = NULL; /* Check the file handler*/ if (NULL == fp) { @@ -3198,7 +3205,11 @@ void dump_verilog_mem_sram_submodule(FILE* fp, break; case SPICE_SRAM_SCAN_CHAIN: /* Only dump the global ports belonging to a spice_model */ - if (0 < rec_dump_verilog_spice_model_global_ports(fp, cur_sram_verilog_model, FALSE, TRUE, my_bool_to_boolean(is_explicit_mapping))) { + rec_stats_spice_model_global_ports(cur_sram_verilog_model, + TRUE, + &spice_model_head); + if (0 < dump_verilog_global_ports( fp, spice_model_head, FALSE, is_explicit_mapping)) { + //if (0 < rec_dump_verilog_spice_model_global_ports(fp, cur_sram_verilog_model, FALSE, TRUE, FALSE)) { fprintf(fp, ",\n"); } if (SPICE_MODEL_MUX == cur_verilog_model->type) { diff --git a/vpr7_x2p/vpr/regression_verilog.sh b/vpr7_x2p/vpr/regression_verilog.sh index 190ae5523..644c9c3f3 100755 --- a/vpr7_x2p/vpr/regression_verilog.sh +++ b/vpr7_x2p/vpr/regression_verilog.sh @@ -25,7 +25,7 @@ arch_ff_keyword="FFPATHKEYWORD" # Remove previous designs rm -rf $verilog_output_dirpath/$verilog_output_dirname -mkdir ${OpenFPGA_path}/fpga_flow/arch/generated +mkdir -p ${OpenFPGA_path}/fpga_flow/arch/generated cd $fpga_flow_scripts perl rewrite_path_in_file.pl -i $template_arch_xml_file -o $arch_xml_file @@ -33,7 +33,8 @@ perl rewrite_path_in_file.pl -i $arch_xml_file -k $arch_ff_keyword $new_ff_path cd - # Run VPR -./vpr $arch_xml_file $blif_file --full_stats --nodisp --activity_file $act_file --fpga_verilog --fpga_verilog_dir $verilog_output_dirpath/$verilog_output_dirname --fpga_x2p_rename_illegal_port --fpga_bitstream_generator --fpga_verilog_print_top_testbench --fpga_verilog_print_input_blif_testbench --fpga_verilog_include_timing --fpga_verilog_include_signal_init --fpga_verilog_print_formal_verification_top_netlist --fpga_verilog_print_autocheck_top_testbench $verilog_reference --fpga_verilog_print_user_defined_template --route_chan_width $vpr_route_chan_width --fpga_verilog_include_icarus_simulator --fpga_verilog_print_report_timing_tcl --power --tech_properties $tech_file --fpga_verilog_print_sdc_pnr --fpga_verilog_print_sdc_analysis --fpga_x2p_compact_routing_hierarchy --fpga_verilog_explicit_mapping +#echo "./vpr $arch_xml_file $blif_file --full_stats --nodisp --activity_file $act_file --fpga_verilog --fpga_verilog_dir $verilog_output_dirpath/$verilog_output_dirname --fpga_x2p_rename_illegal_port --fpga_bitstream_generator --fpga_verilog_print_top_testbench --fpga_verilog_print_input_blif_testbench --fpga_verilog_include_timing --fpga_verilog_include_signal_init --fpga_verilog_print_formal_verification_top_netlist --fpga_verilog_print_autocheck_top_testbench $verilog_reference --fpga_verilog_print_user_defined_template --route_chan_width $vpr_route_chan_width --fpga_verilog_include_icarus_simulator --fpga_verilog_print_report_timing_tcl --power --tech_properties $tech_file --fpga_verilog_print_sdc_pnr --fpga_verilog_print_sdc_analysis --fpga_x2p_compact_routing_hierarchy #--fpga_verilog_explicit_mapping" +./vpr $arch_xml_file $blif_file --full_stats --nodisp --activity_file $act_file --fpga_verilog --fpga_verilog_dir $verilog_output_dirpath/$verilog_output_dirname --fpga_x2p_rename_illegal_port --fpga_bitstream_generator --fpga_verilog_print_top_testbench --fpga_verilog_print_input_blif_testbench --fpga_verilog_include_timing --fpga_verilog_include_signal_init --fpga_verilog_print_formal_verification_top_netlist --fpga_verilog_print_autocheck_top_testbench $verilog_reference --fpga_verilog_print_user_defined_template --route_chan_width $vpr_route_chan_width --fpga_verilog_include_icarus_simulator --fpga_verilog_print_report_timing_tcl --power --tech_properties $tech_file --fpga_verilog_print_sdc_pnr --fpga_verilog_print_sdc_analysis --fpga_x2p_compact_routing_hierarchy #--fpga_verilog_explicit_mapping cd $fpga_flow_scripts perl rewrite_path_in_file.pl -i $ff_path -o $new_ff_path -k $ff_keyword $ff_include_path