Skip to content

Commit 0e4972d

Browse files
authored
Merge branch 'master' into zerodiv
2 parents c320b49 + b208f2e commit 0e4972d

File tree

2,425 files changed

+345053
-364454
lines changed

Some content is hidden

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

2,425 files changed

+345053
-364454
lines changed

.github/scripts/run-vtr.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export VTR_DIR=$(pwd)
99
source $SCRIPT_DIR/hostsetup.sh
1010

1111
if ! { [ $VTR_TEST == "vtr_reg_strong" ] || [ $VTR_TEST == "odin_reg_strong" ] \
12-
|| [ $VTR_TEST == "odin_tech_strong" ] || [ $VTR_TEST == "vtr_reg_yosys_odin" ]; }; then
12+
|| [ $VTR_TEST == "odin_tech_strong" ] || [ $VTR_TEST == "vtr_reg_yosys_odin" ] \
13+
|| [ $VTR_TEST == "vtr_reg_yosys" ] || [ $VTR_TEST == "vtr_reg_yosys_parmys" ]; }; then
1314
source $SCRIPT_DIR/vtr-full-setup.sh
1415
fi
1516

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- {test: "vtr_reg_strong", cores: "16", options: "", cmake: "-DVTR_ASSERT_LEVEL=3", extra_pkgs: "libeigen3-dev"}
3636
- {test: "vtr_reg_strong", cores: "16", options: "-skip_qor", cmake: "-DVTR_ASSERT_LEVEL=3 -DVTR_ENABLE_SANITIZE=ON", extra_pkgs: "libeigen3-dev"}
3737
- {test: "vtr_reg_yosys", cores: "16", options: "", cmake: "-DWITH_YOSYS=ON -DYOSYS_SV_UHDM_PLUGIN=ON", extra_pkgs: ""}
38-
- {test: "vtr_reg_yosys_parmys", cores: "16", options: "", cmake: "-DWITH_YOSYS=ON -DYOSYS_PARMYS_PLUGIN=ON", extra_pkgs: ""}
38+
- {test: "vtr_reg_yosys_parmys", cores: "16", options: "", cmake: "-DWITH_YOSYS=ON -DYOSYS_PARMYS_PLUGIN=ON -DYOSYS_SV_UHDM_PLUGIN=ON", extra_pkgs: ""}
3939
- {test: "vtr_reg_yosys_odin", cores: "16", options: "", cmake: "-DODIN_USE_YOSYS=ON -DYOSYS_SV_UHDM_PLUGIN=ON", extra_pkgs: ""}
4040
- {test: "odin_tech_strong", cores: "16", options: "", cmake: "-DODIN_USE_YOSYS=ON", extra_pkgs: ""}
4141
- {test: "odin_reg_strong", cores: "16", options: "", cmake: "", extra_pkgs: ""}

ODIN_II/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ add_library(libodin_ii STATIC
154154

155155
# link libyosys to the Odin-II library
156156
if(${ODIN_USE_YOSYS})
157-
target_link_libraries(libodin_ii libyosys)
157+
add_dependencies(libodin_ii libyosys)
158+
target_link_directories(libodin_ii PUBLIC ${VTR_SOURCE_DIR}/build/libs/EXTERNAL/libyosys)
159+
target_include_directories(libodin_ii PUBLIC ${VTR_SOURCE_DIR}/Yosys/share/yosys/include)
160+
target_link_libraries(libodin_ii yosys)
158161
endif()
159162

160163
target_include_directories(libodin_ii PUBLIC ${LIB_INCLUDE_DIRS})
@@ -224,3 +227,4 @@ if(VTR_ENABLE_STRICT_COMPILE)
224227
endif()
225228

226229
install(TARGETS odin_II libodin_ii DESTINATION bin)
230+
install(FILES ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} DESTINATION include/libodin_ii)

ODIN_II/SRC/BLIF.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2021 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,8 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
* @file the definition of the BLIF class constructor, destructor
2624
*/
2725

2826
#include "BLIF.hpp"

ODIN_II/SRC/BLIFElaborate.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2021 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,14 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
* @file a netlist traversal phase newly added to Odin-II techmap.
26-
* Basically, this file includes the resolve_XXX_node routines to
27-
* make high-level netlist nodes compatible with Odin-II partial
28-
* mapper. However, the instantiation process of operations that
29-
* aren't supported by Odin-II synthesis flow is also implemented
30-
* in this phase.
31-
* E.g. Division (constant, variable), Exponentiation (variable)
3224
*/
3325

3426
#include <string.h>

ODIN_II/SRC/BLIFReader.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/**
2-
*
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
3+
*
34
* Permission is hereby granted, free of charge, to any person
45
* obtaining a copy of this software and associated documentation
56
* files (the "Software"), to deal in the Software without
@@ -20,14 +21,6 @@
2021
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2122
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2223
* OTHER DEALINGS IN THE SOFTWARE.
23-
*
24-
* @file: includes the definition of BLIF Reader class to read a given
25-
* BLIF file. The Odin-II BLIF Reader can also read large files since
26-
* it read each file with a BLIF_READ_BUFFER chunk or line by line.
27-
* Odin-II BLIF Reader caches the read models while traversing the
28-
* BLIF file to avoid searching the BLIF file looking for the model
29-
* definition. Moreover, function getbline provides developers with
30-
* the ability to read a BLIF file line by line or using a chunk.
3124
*/
3225

3326
#include <stdlib.h>

ODIN_II/SRC/BLIFWriter.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/**
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
3+
*
24
* Permission is hereby granted, free of charge, to any person
35
* obtaining a copy of this software and associated documentation
46
* files (the "Software"), to deal in the Software without
@@ -19,12 +21,6 @@
1921
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2022
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2123
* OTHER DEALINGS IN THE SOFTWARE.
22-
*
23-
* @file: definition of BLIF Writer routine to generate a BLIF output
24-
* file. Unlike other tools that print each BLIF record in a single
25-
* line, Odin-II BLIF Writer prints BLIF records in a specified size.
26-
* That means it makes the BLIF file more readable by splitting the
27-
* line by the specified threshold.
2824
*/
2925

3026
#include <stdlib.h>

ODIN_II/SRC/BitwiseOps.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2022 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,9 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
* @file: This file provides utilities to modify the bitwise nodes
26-
* to make them compatible with the Odin-II partial mapper.
2724
*/
2825

2926
#include <cmath> // log2

ODIN_II/SRC/BlockMemories.cpp

Lines changed: 97 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2021 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,17 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
* @file: This file includes the definitions of the routines to map
26-
* block memories to VTR compatible memory types, i.e., Single Port RAM
27-
* and Dual Port RAM. The definition of block memory and read-only memory
28-
* is provided in techlib directory in the Odin-II root directory.
29-
* Basically, a memory block with both read and write accesses that has a
30-
* separate port for each operation is called BRAM. While following the
31-
* same definition, a read-only memory block is referred to as a BRAM that
32-
* has only read access (even multiple accesses). This function also
33-
* includes ymem block support which somehow represents the Yosys internal
34-
* memory cell.
3524
*/
3625

3726
#include <string.h>
@@ -68,6 +57,7 @@ static void create_r2w_dual_port_ram(block_memory_t* bram, netlist_t* netlist);
6857
static void create_2rw_dual_port_ram(block_memory_t* bram, netlist_t* netlist);
6958
static void create_2r2w_dual_port_ram(block_memory_t* bram, netlist_t* netlist);
7059
static void create_nrmw_dual_port_ram(block_memory_t* bram, netlist_t* netlist);
60+
static void create_2rw_multiplexed_dual_port_ram(block_memory_t* bram, netlist_t* netlist);
7161

7262
static nnode_t* ymem_to_rom(nnode_t* node, uintptr_t traverse_mark_number);
7363
static nnode_t* ymem2_to_rom(nnode_t* node, uintptr_t traverse_mark_number);
@@ -850,11 +840,6 @@ static void create_2rw_dual_port_ram(block_memory_t* bram, netlist_t* netlist) {
850840
add_pin_to_signal_list(rd_data2, bram->read_data->pins[i + offset]);
851841
}
852842

853-
/* delete rd pins since we use corresponding wr_en and zero*/
854-
for (i = 0; i < bram->read_en->count; ++i) {
855-
delete_npin(bram->read_en->pins[i]);
856-
}
857-
858843
/**
859844
* [NOTE]:
860845
* Odin-II handle memory block with more than two distint
@@ -874,11 +859,16 @@ static void create_2rw_dual_port_ram(block_memory_t* bram, netlist_t* netlist) {
874859
free_signal_list(rd_data2);
875860

876861
/* all ports have different address */
877-
create_nrmw_dual_port_ram(bram, netlist);
862+
create_2rw_multiplexed_dual_port_ram(bram, netlist);
878863
return;
879864
}
880865
}
881866

867+
/* delete rd pins since we use corresponding wr_en and zero*/
868+
for (i = 0; i < bram->read_en->count; ++i) {
869+
delete_npin(bram->read_en->pins[i]);
870+
}
871+
882872
/* map matched read data to the out1 */
883873
signals->out1 = (first_match) ? rd_data1 : rd_data2;
884874

@@ -979,11 +969,6 @@ static void create_2r2w_dual_port_ram(block_memory_t* bram, netlist_t* netlist)
979969
add_pin_to_signal_list(rd_data2, bram->read_data->pins[i + offset]);
980970
}
981971

982-
/* delete rd pins since we use corresponding wr_en and zero*/
983-
for (i = 0; i < bram->read_en->count; ++i) {
984-
delete_npin(bram->read_en->pins[i]);
985-
}
986-
987972
/**
988973
* [NOTE]:
989974
* Odin-II handle memory block with more than two distint
@@ -1012,6 +997,11 @@ static void create_2r2w_dual_port_ram(block_memory_t* bram, netlist_t* netlist)
1012997
return;
1013998
}
1014999

1000+
/* delete rd pins since we use corresponding wr_en and zero*/
1001+
for (i = 0; i < bram->read_en->count; ++i) {
1002+
delete_npin(bram->read_en->pins[i]);
1003+
}
1004+
10151005
/* create a list of dpram ram signals */
10161006
dp_ram_signals* signals = (dp_ram_signals*)vtr::malloc(sizeof(dp_ram_signals));
10171007

@@ -1163,6 +1153,88 @@ static void create_nrmw_dual_port_ram(block_memory_t* bram, netlist_t* netlist)
11631153
free_dp_ram_signals(signals);
11641154
}
11651155

1156+
/**
1157+
* (function: create_2rw_multiplexed_dual_port_ram)
1158+
*
1159+
* @brief read ports are multiplexed using read enable.
1160+
* multiple write ports are multiplexed using write enable.
1161+
* Then, the BRAM will be mapped to a DPRAM
1162+
*
1163+
* @param bram pointing to a bram node node
1164+
* @param netlist pointer to the current netlist file
1165+
*/
1166+
static void create_2rw_multiplexed_dual_port_ram(block_memory_t* bram, netlist_t* netlist) {
1167+
int i;
1168+
nnode_t* old_node = bram->node;
1169+
int data_width = bram->node->attributes->DBITS;
1170+
int addr_width = bram->node->attributes->ABITS;
1171+
int num_rd_ports = old_node->attributes->RD_PORTS;
1172+
int num_wr_ports = old_node->attributes->WR_PORTS;
1173+
1174+
/* should have been resovled before this function */
1175+
oassert(num_rd_ports == 2);
1176+
oassert(num_wr_ports == 1);
1177+
1178+
/* dual port ram signals */
1179+
dp_ram_signals* signals = (dp_ram_signals*)vtr::calloc(1, sizeof(dp_ram_signals));
1180+
signal_list_t* selectors = NULL;
1181+
1182+
/* INPUTS */
1183+
selectors = copy_input_signals(bram->read_en);
1184+
/* adding the read addr input port as address1 */
1185+
signals->addr1 = split_cascade_port(bram->read_addr,
1186+
selectors,
1187+
addr_width,
1188+
old_node,
1189+
netlist);
1190+
free_signal_list(selectors);
1191+
1192+
signals->addr2 = init_signal_list();
1193+
for (i = 0; i < bram->write_addr->count; ++i) {
1194+
add_pin_to_signal_list(signals->addr2, bram->write_addr->pins[i]);
1195+
}
1196+
1197+
/* handling clock signals */
1198+
signals->clk = bram->clk->pins[0];
1199+
1200+
/* we pad the first data port using pad pins */
1201+
signals->data1 = init_signal_list();
1202+
for (i = 0; i < data_width; ++i) {
1203+
add_pin_to_signal_list(signals->data1, get_pad_pin(netlist));
1204+
}
1205+
1206+
signals->data2 = init_signal_list();
1207+
for (i = 0; i < data_width; ++i) {
1208+
add_pin_to_signal_list(signals->data2, bram->write_data->pins[i]);
1209+
}
1210+
1211+
/* first port does not have data, so the enable is GND */
1212+
signals->we1 = get_zero_pin(netlist);
1213+
1214+
signals->we2 = bram->write_en->pins[0];
1215+
1216+
/* OUTPUT */
1217+
/* leaving out1 of dpram null, so it will create a new pins */
1218+
signals->out1 = NULL;
1219+
signals->out2 = NULL;
1220+
1221+
/* create a DPRAM node */
1222+
nnode_t* dpram = create_dual_port_ram(signals, old_node);
1223+
1224+
signal_list_t* dpram_outputs = init_signal_list();
1225+
for (i = 0; i < data_width; ++i) {
1226+
add_pin_to_signal_list(dpram_outputs, dpram->output_pins[i]);
1227+
}
1228+
1229+
/* decode the spram outputs to the n bram output ports */
1230+
decode_out_port(dpram_outputs, bram->read_data, bram->read_en, old_node, netlist);
1231+
1232+
// CLEAN UP
1233+
cleanup_block_memory_old_node(old_node);
1234+
free_signal_list(dpram_outputs);
1235+
free_dp_ram_signals(signals);
1236+
}
1237+
11661238
/**
11671239
* (function: map_rom_to_mem_hardblocks)
11681240
*
@@ -2234,4 +2306,4 @@ static void free_block_memory(block_memory_t* to_free) {
22342306
vtr::free(to_free->memory_id);
22352307

22362308
vtr::free(to_free);
2237-
}
2309+
}

ODIN_II/SRC/CaseEqual.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2021 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,10 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
* @file: this file includes the circuitry implementation of case_equal
26-
* and case_not_equal high-level netlist nodes. The implementations
27-
* are XNOR, AND and invertor gates based.
2824
*/
2925

3026
#include "CaseEqual.hpp"

ODIN_II/SRC/Division.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2021 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,13 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
*
26-
* @file Division.cpp comprises the combinational implementation of
27-
* Division operation using shift and subtraction nodes. To utilize
28-
* this routine of this file, a high-level RTL DIV node is required
29-
* with port order according to what is mentioned in resolve_div_node.
30-
* Currently, this file is used by Yosys generated division sub-circuit.
3124
*/
3225

3326
#include "Division.hpp"

ODIN_II/SRC/FlipFlop.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/**
2-
* Copyright (c) 2021 Seyed Alireza Damghani ([email protected])
1+
/*
2+
* Copyright 2023 CAS—Atlantic (University of New Brunswick, CASA)
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation
@@ -21,17 +21,6 @@
2121
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2222
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
25-
* @file: This file includes the circuitry implementation of six synchronous
26-
* Data Flip-Flop models. All control signals will be check based on their
27-
* polarity specified in the attribute structure of the related node.
28-
* SDFF: A DFF with synchronous reset
29-
* DFFE: A DFF with enable signal
30-
* SDFFE: A DFF with enabling and synchronous signals
31-
* SDFFCE: A DFF with enable signal prior to the synchronous reset
32-
* (enable needs to be active to be able to reset)
33-
* DFFSR: A DFF with set (VCC) and clear (GND) signals
34-
* DFFSRE: A DFF with the set (VCC), clear (GND), and enable signals
3524
*/
3625

3726
#include "FlipFlop.hpp"

0 commit comments

Comments
 (0)