Skip to content

Commit 49797b3

Browse files
authored
Merge branch 'master' into m1
2 parents 97244e7 + 2f34458 commit 49797b3

File tree

367 files changed

+27006
-9233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+27006
-9233
lines changed

.github/scripts/hostsetup.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ apt install -y \
3030
build-essential \
3131
capnproto \
3232
clang \
33-
cmake \
3433
ctags \
3534
curl \
3635
doxygen \
@@ -65,12 +64,23 @@ apt install -y \
6564
valgrind \
6665
zip \
6766
qt5-default \
67+
uuid-dev \
68+
default-jdk \
6869
g++-9 \
6970
gcc-9 \
7071
wget
7172
# Don't include libtbb-dev since it may increase memory usage
7273
#libtbb-dev \
7374

75+
# installing the latest version of cmake
76+
apt install -y apt-transport-https ca-certificates gnupg
77+
wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc |apt-key add -
78+
79+
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
80+
apt update
81+
apt install -y cmake
82+
83+
7484
export PATH="$PATH:/home/kbuilder/.local/bin"
7585

7686
export CC=gcc-9

.github/scripts/install_dependencies.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ sudo apt install -y \
3939
valgrind \
4040
zip \
4141
qt5-default \
42+
uuid-dev \
43+
default-jdk \
4244
clang-format-7 \
4345
g++-7 \
4446
gcc-7 \

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
- {test: "vtr_reg_nightly_test4", cores: "16", options: "", cmake: "" }
3333
- {test: "vtr_reg_strong", cores: "16", options: "", cmake: "-DVTR_ASSERT_LEVEL=3" }
3434
- {test: "vtr_reg_strong", cores: "16", options: "-skip_qor", cmake: "-DVTR_ASSERT_LEVEL=3 -DVTR_ENABLE_SANITIZE=ON"}
35-
- {test: "vtr_reg_yosys", cores: "16", options: "", cmake: "-DWITH_YOSYS=ON" }
36-
- {test: "vtr_reg_yosys_odin", cores: "16", options: "", cmake: "-DODIN_USE_YOSYS=ON" }
35+
- {test: "vtr_reg_yosys", cores: "16", options: "", cmake: "-DWITH_YOSYS=ON -DYOSYS_SV_UHDM_PLUGIN=ON" }
36+
- {test: "vtr_reg_yosys_odin", cores: "16", options: "", cmake: "-DODIN_USE_YOSYS=ON -DYOSYS_SV_UHDM_PLUGIN=ON"}
3737
- {test: "odin_tech_strong", cores: "16", options: "", cmake: "-DODIN_USE_YOSYS=ON" }
3838
- {test: "odin_reg_strong", cores: "16", options: "", cmake: "" }
3939

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ bin/
1212
CMakeCache.txt
1313
CMakeFiles
1414
build
15+
Yosys
1516

1617
#
1718
#VTR Flow/Tasks
@@ -105,6 +106,11 @@ ODIN_II/usefull_tools/**/track_completed
105106
#
106107
Yosys
107108

109+
#
110+
#ArchFPGA exec dir
111+
#
112+
ArchFPGA
113+
108114
#
109115
#Python
110116
#

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ option(ODIN_SANITIZE "Enable building odin with sanitize flags" OFF)
5555
# Allow the user to enable building Yosys
5656
option(WITH_YOSYS "Enable building Yosys" OFF)
5757
option(ODIN_USE_YOSYS "Enable building Yosys" OFF)
58+
option(YOSYS_SV_UHDM_PLUGIN "Enable building and installing Yosys SystemVerilog and UHDM plugins" OFF)
5859

5960
set(VTR_VERSION_MAJOR 8)
6061
set(VTR_VERSION_MINOR 1)
@@ -398,6 +399,14 @@ elseif(${WITH_ODIN})
398399
endif()
399400
endif()
400401

402+
# handle cmake params to compile Yosys SystemVerilog/UHDM plugins
403+
if(${YOSYS_SV_UHDM_PLUGIN})
404+
# avoid compiling plugins in case the Yosys frontend is not active
405+
if(NOT ${WITH_YOSYS} AND NOT ${ODIN_USE_YOSYS})
406+
message(SEND_ERROR "Utilizing SystemVerilog/UHDM plugins requires activating Yosys frontend. Please set either WITH_YOSYS or ODIN_USE_YOSYS on.")
407+
endif()
408+
endif()
409+
401410
#Add extra compilation flags to suppress warnings from some libraries/tools
402411
# Note that target_compile_options() *appends* to the current compilation options of
403412
# the specified target

ODIN_II/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ if(ODIN_DEBUG)
77
message("*** Compiling with Odin debug flags")
88

99
set(ODIN_EXTRA_FLAGS
10-
"-g"
11-
"-ggdb"
10+
"-g3"
11+
"-ggdb3"
1212
"-O0"
1313
${ODIN_EXTRA_FLAGS}
1414
)
@@ -136,6 +136,9 @@ endif()
136136
if(${ODIN_USE_YOSYS})
137137
add_definitions("-DODIN_USE_YOSYS=ON")
138138
add_definitions("-D_YOSYS_")
139+
if(${YOSYS_SV_UHDM_PLUGIN})
140+
add_definitions("-DYOSYS_SV_UHDM_PLUGIN=ON")
141+
endif()
139142
endif()
140143

141144
add_definitions(-DUSING_BISON -DYYERROR_VERBOSE)

ODIN_II/SRC/BLIFElaborate.cpp

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include "hard_blocks.h"
5151
#include "memories.h"
5252
#include "BlockMemories.hpp"
53+
#include "BitwiseOps.hpp"
5354
#include "LogicalOps.hpp"
5455
#include "memories.h"
5556
#include "adders.h"
@@ -72,6 +73,7 @@ void depth_first_traverse_blif_elaborate(nnode_t* node, uintptr_t traverse_mark_
7273

7374
void blif_elaborate_node(nnode_t* node, short traverse_mark_number, netlist_t* netlist);
7475

76+
static void resolve_bitwise_nodes(nnode_t* node, uintptr_t traverse_mark_number, netlist_t* netlist);
7577
static void resolve_logical_nodes(nnode_t* node, uintptr_t traverse_mark_number, netlist_t* netlist);
7678
static void resolve_shift_nodes(nnode_t* node, uintptr_t traverse_mark_number, netlist_t* netlist);
7779
static void resolve_case_equal_nodes(nnode_t* node, uintptr_t traverse_mark_number, netlist_t* netlist);
@@ -200,6 +202,19 @@ void depth_first_traverse_blif_elaborate(nnode_t* node, uintptr_t traverse_mark_
200202
*--------------------------------------------------------------------*/
201203
void blif_elaborate_node(nnode_t* node, short traverse_number, netlist_t* netlist) {
202204
switch (node->type) {
205+
case BITWISE_NOT: //fallthrough
206+
case BITWISE_AND: //fallthrough
207+
case BITWISE_OR: //fallthrough
208+
case BITWISE_NAND: //fallthrough
209+
case BITWISE_NOR: //fallthrough
210+
case BITWISE_XNOR: //fallthrough
211+
case BITWISE_XOR: {
212+
/**
213+
* make sure they have only two inputs and a single output pin for partial mapping phase
214+
*/
215+
resolve_bitwise_nodes(node, traverse_number, netlist);
216+
break;
217+
}
203218
case GTE: //fallthrough
204219
case LTE: //fallthrough
205220
case GT: //fallthrough
@@ -296,20 +311,13 @@ void blif_elaborate_node(nnode_t* node, short traverse_number, netlist_t* netlis
296311
resolve_memory_nodes(node, traverse_number, netlist);
297312
break;
298313
}
299-
case GND_NODE: //fallthrough
300-
case VCC_NODE: //fallthrough
301-
case PAD_NODE: //fallthrough
302-
case INPUT_NODE: //fallthrough
303-
case OUTPUT_NODE: //fallthrough
304-
case HARD_IP: //fallthrough
305-
case BUF_NODE: //fallthrough
306-
case BITWISE_NOT: //fallthrough
307-
case BITWISE_AND: //fallthrough
308-
case BITWISE_OR: //fallthrough
309-
case BITWISE_NAND: //fallthrough
310-
case BITWISE_NOR: //fallthrough
311-
case BITWISE_XNOR: //fallthrough
312-
case BITWISE_XOR: {
314+
case GND_NODE: //fallthrough
315+
case VCC_NODE: //fallthrough
316+
case PAD_NODE: //fallthrough
317+
case INPUT_NODE: //fallthrough
318+
case OUTPUT_NODE: //fallthrough
319+
case HARD_IP: //fallthrough
320+
case BUF_NODE: {
313321
/* some are already resolved for this phase */
314322
break;
315323
}
@@ -323,6 +331,45 @@ void blif_elaborate_node(nnode_t* node, short traverse_number, netlist_t* netlis
323331
}
324332
}
325333

334+
/**
335+
* (function: resolve_bitwise_nodes)
336+
*
337+
* @brief resolving the bitwise nodes by decoding them into 2-1 nodes
338+
*
339+
* @param node pointing to a bitwise node
340+
* @param traverse_mark_number unique traversal mark for blif elaboration pass
341+
* @param netlist pointer to the current netlist file
342+
*/
343+
static void resolve_bitwise_nodes(nnode_t* node, uintptr_t traverse_mark_number, netlist_t* netlist) {
344+
oassert(node->traverse_visited == traverse_mark_number);
345+
346+
switch (node->type) {
347+
case BITWISE_XNOR: //fallthrough
348+
case BITWISE_XOR: {
349+
/**
350+
* decode bitwise nodes into nodes with 2 input and 1 output
351+
* only for reduction operation
352+
*/
353+
if (node->num_output_pins == 1)
354+
decode_bitwise_nodes(node, traverse_mark_number, netlist);
355+
break;
356+
}
357+
case BITWISE_NOT: //fallthrough
358+
case BITWISE_AND: //fallthrough
359+
case BITWISE_OR: //fallthrough
360+
case BITWISE_NAND: //fallthrough
361+
case BITWISE_NOR: {
362+
/* to be handled in partial map */
363+
break;
364+
}
365+
default: {
366+
error_message(BLIF_ELABORATION, node->loc,
367+
"The node(%s) type is not among Odin's bitwise types [BITWISE_NOT, BITWISE_AND, BITWISE_OR, BITWISE_NAND, BITWISE_NOR, BITWISE_XNOR, BITWISE_XOR]\n", node->name);
368+
break;
369+
}
370+
}
371+
}
372+
326373
/**
327374
* (function: resolve_logical_nodes)
328375
*

ODIN_II/SRC/BLIFReader.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,18 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
348348
/* check for coarse-grain configuration */
349349
if (configuration.coarsen) {
350350
if (yosys_subckt_strmap.find(subcircuit_name) != yosys_subckt_strmap.end())
351-
new_node->type = yosys_subckt_strmap[subcircuit_name];
351+
new_node->type = yosys_subckt_strmap.at(subcircuit_name);
352352

353353
if (new_node->type == NO_OP && yosys_subckt_strmap.find(subcircuit_stripped_name) != yosys_subckt_strmap.end())
354-
new_node->type = yosys_subckt_strmap[subcircuit_stripped_name];
354+
new_node->type = yosys_subckt_strmap.at(subcircuit_stripped_name);
355355

356356
if (new_node->type == NO_OP) {
357357
/* in case of weird names, need to add memories manually */
358358
int sc_spot = -1;
359359
char* yosys_subckt_str = NULL;
360360
if ((yosys_subckt_str = retrieve_node_type_from_subckt_name(subcircuit_stripped_name)) != NULL) {
361361
/* specify node type */
362-
new_node->type = yosys_subckt_strmap[yosys_subckt_str];
362+
new_node->type = yosys_subckt_strmap.at(yosys_subckt_str);
363363
} else if ((sc_spot = sc_lookup_string(hard_block_names, subcircuit_stripped_name)) != -1) {
364364
/* specify node type */
365365
new_node->type = HARD_IP;
@@ -387,11 +387,14 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
387387
: operation_list_END;
388388
}
389389
} else {
390-
new_node->type = odin_subckt_strmap[subcircuit_name];
390+
if (odin_subckt_strmap.find(subcircuit_name) != odin_subckt_strmap.end())
391+
new_node->type = odin_subckt_strmap.at(subcircuit_name);
391392

392393
/* check for subcircuit prefix prefix */
393-
if (subcircuit_stripped_name && new_node->type == NO_OP)
394-
new_node->type = odin_subckt_strmap[subcircuit_stripped_name];
394+
if (subcircuit_stripped_name
395+
&& new_node->type == NO_OP
396+
&& odin_subckt_strmap.find(subcircuit_stripped_name) != odin_subckt_strmap.end())
397+
new_node->type = odin_subckt_strmap.at(subcircuit_stripped_name);
395398

396399
if (new_node->type == NO_OP)
397400
new_node->type = MEMORY;
@@ -2050,6 +2053,8 @@ hard_block_model* BLIF::Reader::create_hard_block_model(const char* name, operat
20502053
case (BITWISE_OR): //fallthrough
20512054
case (BITWISE_NOT): //fallthrough
20522055
case (BITWISE_AND): //fallthrough
2056+
case (BITWISE_XOR): //fallthrough
2057+
case (BITWISE_XNOR): //fallthrough
20532058
case (LOGICAL_OR): //fallthrough
20542059
case (LOGICAL_XOR): //fallthrough
20552060
case (LOGICAL_AND): //fallthrough
@@ -2176,7 +2181,7 @@ void BLIF::Reader::hard_block_sensitivities(const char* subckt_name, nnode_t* ne
21762181
char* buffer = NULL;
21772182
attr_t* attributes = new_node->attributes;
21782183
operation_list op = (yosys_subckt_strmap.find(subckt_name) != yosys_subckt_strmap.end())
2179-
? yosys_subckt_strmap[subckt_name]
2184+
? yosys_subckt_strmap.at(subckt_name)
21802185
: NO_OP;
21812186

21822187
if (need_params(op)) {

0 commit comments

Comments
 (0)