Skip to content

Commit 84f79d0

Browse files
committed
include more arch in benchmark
1 parent 14e54f7 commit 84f79d0

17 files changed

+2274
-1223
lines changed

ODIN_II/SRC/include/soft_logic_def_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ typedef struct soft_sub_structure_t
4747
int bitsize;
4848
}soft_sub_structure;
4949

50-
void read_soft_def_file(std::string input_file_name);
50+
void read_soft_def_file(t_model *hard_adder_models);
5151
soft_sub_structure *fetch_blk(std::string, int width);
5252

5353

ODIN_II/SRC/include/types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ struct global_args_t_t
183183
argparse::ArgValue<bool> sim_generate_three_valued_logic;
184184
// Output both falling and rising edges in the output_vectors file. (DEFAULT)
185185
argparse::ArgValue<bool> sim_output_both_edges;
186+
// Request to read mif file input
187+
argparse::ArgValue<bool> read_mif_input;
186188
// Additional pins, nets, and nodes to output.
187189
argparse::ArgValue<std::vector<std::string>> sim_additional_pins;
188190
// Comma-separated list of primary input pins to hold high for all cycles but the first.

ODIN_II/SRC/odin_ii.cpp

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ t_type_descriptor* type_descriptors;
7878
int block_tag;
7979
int num_types=0;
8080

81-
static int synthesize_verilog()
81+
typedef enum
82+
{
83+
SUCCESS,
84+
ERROR_PARSE_ARCH,
85+
ERROR_SYNTHESIS,
86+
ERROR_PARSE_BLIF,
87+
88+
}ODIN_ERROR_CODE;
89+
90+
static ODIN_ERROR_CODE synthesize_verilog()
8291
{
8392
double elaboration_time = wall_time();
8493

@@ -91,14 +100,7 @@ static int synthesize_verilog()
91100
register_hard_blocks();
92101

93102
/* get odin soft_logic definition file */
94-
std::string soft_distribution(global_args.adder_def);
95-
if(!hard_adders && soft_distribution == "default")
96-
{
97-
if(soft_distribution == "optimized")
98-
soft_distribution = vtr::dirname(global_args.program_name) + "odin.soft_config";
99-
100-
read_soft_def_file(soft_distribution);
101-
}
103+
read_soft_def_file(hard_adders);
102104

103105
global_param_table_sc = sc_new_string_cache();
104106

@@ -195,7 +197,7 @@ static int synthesize_verilog()
195197
//cleanup netlist
196198
free_netlist(verilog_netlist);
197199

198-
return 0;
200+
return SUCCESS;
199201
}
200202

201203
struct netlist_t_t *start_odin_ii(int argc,char **argv)
@@ -213,8 +215,6 @@ struct netlist_t_t *start_odin_ii(int argc,char **argv)
213215
mkdir(DEFAULT_OUTPUT, 0755);
214216
#endif
215217

216-
int error_code = 0;
217-
218218
printf("--------------------------------------------------------------------\n");
219219
printf("Welcome to ODIN II version 0.1 - the better High level synthesis tools++ targetting FPGAs (mainly VPR)\n");
220220
printf("Email: [email protected] and [email protected] for support issues\n\n");
@@ -242,30 +242,25 @@ struct netlist_t_t *start_odin_ii(int argc,char **argv)
242242
}
243243
catch(vtr::VtrError& vtr_error)
244244
{
245-
printf("Failed to load architecture file: %s\n", vtr_error.what());
246-
error_code = 1;
245+
printf("Odin Failed to load architecture file: %s with exit code%d\n", vtr_error.what(), ERROR_PARSE_ARCH);
246+
exit(ERROR_PARSE_ARCH);
247247
}
248248
}
249249

250-
if(error_code)
251-
{
252-
printf("Odin Failed to start with exit status: %d\n", error_code);
253-
terminate_odin_ii(verilog_netlist);
254-
return NULL;
255-
}
256-
257250
/* do High level Synthesis */
258251
if (!global_args.blif_file)
259252
{
260-
error_code = synthesize_verilog();
261-
}
262-
263-
if(error_code)
264-
{
265-
printf("Odin Failed to parse Verilog with exit status: %d\n", error_code);
266-
return NULL;
253+
ODIN_ERROR_CODE error_code = synthesize_verilog();
254+
if(error_code)
255+
{
256+
printf("Odin Failed to parse Verilog with exit status: %d\n", error_code);
257+
exit(error_code);
258+
}
267259
}
268260

261+
/*************************************************************
262+
* begin simulation section
263+
*/
269264
netlist_t *odin_netlist = NULL;
270265

271266
if(global_args.blif_file
@@ -279,6 +274,7 @@ struct netlist_t_t *start_odin_ii(int argc,char **argv)
279274
{
280275
char *output_file = global_args.output_file;
281276
configuration.list_of_file_names = { std::string(output_file) };
277+
current_parse_file =0;
282278
}
283279

284280
try
@@ -287,17 +283,11 @@ struct netlist_t_t *start_odin_ii(int argc,char **argv)
287283
}
288284
catch(vtr::VtrError& vtr_error)
289285
{
290-
printf("Failed to load blif file: %s\n", vtr_error.what());
291-
error_code = 1;
286+
printf("Odin Failed to load blif file: %s with exit code:%d \n", vtr_error.what(), ERROR_PARSE_BLIF);
287+
exit(ERROR_PARSE_BLIF);
292288
}
293289
}
294290

295-
if(error_code)
296-
{
297-
printf("Odin Failed to read Blif with exit status: %d\n", error_code);
298-
return NULL;
299-
}
300-
301291
/* Simulate netlist */
302292
if(odin_netlist && !global_args.interactive_simulation
303293
&& (global_args.sim_num_test_vectors || global_args.sim_vector_input_file))
@@ -307,7 +297,7 @@ struct netlist_t_t *start_odin_ii(int argc,char **argv)
307297
}
308298

309299
printf("--------------------------------------------------------------------\n");
310-
printf("Odin ran with exit status: %d\n", error_code);
300+
printf("Odin ran with exit status: %d\n", SUCCESS);
311301
return odin_netlist;
312302
}
313303

@@ -519,6 +509,12 @@ void get_options(int argc, char** argv) {
519509
.default_value("true")
520510
.action(argparse::Action::STORE_TRUE)
521511
;
512+
513+
other_sim_grp.add_argument(global_args.read_mif_input, "--read_mif")
514+
.help("look for a mif file to read")
515+
.default_value("false")
516+
.action(argparse::Action::STORE_TRUE)
517+
;
522518

523519
other_sim_grp.add_argument(global_args.sim_additional_pins, "-p")
524520
.help("list of additional pins/nodes to monitor during simulation.\n"

ODIN_II/SRC/simulate_blif.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,6 @@ static int is_node_ready(nnode_t* node, int cycle)
647647
if (!D_pin->delay_cycle && ff_cycle < cycle)
648648
{
649649
D_pin->delay_cycle = true;
650-
warning_message(SIMULATION_ERROR, -1, -1,
651-
"%s Node %s input %s is behind by a cycle", node_name_based_on_op(node), node->name, D_pin->name);
652650
}
653651

654652
if (ff_cycle < cycle-D_pin->delay_cycle)
@@ -670,8 +668,6 @@ static int is_node_ready(nnode_t* node, int cycle)
670668
if (!pin->delay_cycle && data_cycle < cycle)
671669
{
672670
pin->delay_cycle = true;
673-
warning_message(SIMULATION_ERROR, -1, -1,
674-
"%s Node %s input %s is behind by a cycle", node_name_based_on_op(node), node->name, pin->name);
675671
}
676672

677673
if (data_cycle < cycle-pin->delay_cycle)
@@ -2181,19 +2177,21 @@ static void instantiate_memory(nnode_t *node, int data_width, int addr_width)
21812177
{
21822178
long max_address = 1 << addr_width;
21832179
node->memory_data = std::vector<std::vector<signed char>>(max_address, std::vector<signed char>(data_width, init_value(node)));
2184-
char *filename = get_mif_filename(node);
2185-
2186-
FILE *mif = fopen(filename, "r");
2187-
if (!mif)
2188-
{
2189-
printf("MIF %s (%dx%d) not found. \n", filename, data_width, addr_width);
2190-
}
2191-
else
2180+
if(global_args.read_mif_input)
21922181
{
2193-
assign_memory_from_mif_file(node, mif, filename, data_width, addr_width);
2194-
fclose(mif);
2182+
char *filename = get_mif_filename(node);
2183+
FILE *mif = fopen(filename, "r");
2184+
if (!mif)
2185+
{
2186+
printf("MIF %s (%dx%d) not found. \n", filename, data_width, addr_width);
2187+
}
2188+
else
2189+
{
2190+
assign_memory_from_mif_file(node, mif, filename, data_width, addr_width);
2191+
fclose(mif);
2192+
}
2193+
vtr::free(filename);
21952194
}
2196-
vtr::free(filename);
21972195
}
21982196

21992197
/*

ODIN_II/SRC/soft_logic_def_parser.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ OTHER DEALINGS IN THE SOFTWARE.
3333

3434
#include "vtr_util.h"
3535
#include "vtr_memory.h"
36+
#include "vtr_path.h"
37+
3638
#include <algorithm>
3739
#include <string>
3840

@@ -61,12 +63,24 @@ blk_len_of_structure
6163
*/
6264
std::map<std::string,soft_sub_structure*> soft_def_map;
6365

64-
void read_soft_def_file(std::string input_file_name)
66+
void read_soft_def_file(t_model *hard_adder_models)
6567
{
66-
FILE *input_file = fopen(input_file_name.c_str(),"r");
67-
if(input_file)
68-
{
69-
printf("Reading soft_logic definition file @ %s ... ", input_file_name.c_str());
68+
std::string soft_distribution(global_args.adder_def);
69+
if(hard_adder_models || !global_args.adder_def || soft_distribution == "default")
70+
{
71+
// given any of these cases do not optimize soft logic for adders
72+
return;
73+
}
74+
75+
// use the default optimized file input
76+
if(soft_distribution == "optimized")
77+
soft_distribution = vtr::dirname(global_args.program_name) + "odin.soft_config";
78+
//else keep as is and try to open it
79+
80+
FILE *input_file = fopen(soft_distribution.c_str(),"r");
81+
if(input_file)
82+
{
83+
printf("Reading soft_logic definition file @ %s ... ", soft_distribution.c_str());
7084

7185
soft_def_map[std::string("+_0")] = NULL;
7286
soft_def_map[std::string("/_0")] = NULL;
@@ -140,7 +154,7 @@ void read_soft_def_file(std::string input_file_name)
140154
}
141155
else
142156
printf("DONE read %d lines\n",line_number);
143-
}
157+
}
144158
}
145159

146160
/*---------------------------------------------------------------------------------------------

ODIN_II/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
int main(int argc, char **argv)
66
{
77
vtr::ScopedFinishTimer t("Odin II");
8-
struct netlist_t_t *odin_netlist = start_odin_ii(argc,argv);
8+
struct netlist_t_t *odin_netlist = start_odin_ii(argc, argv);
99
terminate_odin_ii(odin_netlist);
1010
return 0;
1111

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// DEFINES
2+
`define WIDTH 8 // Bit width
3+
`define DEPTH 3 // Bit depth
4+
5+
module pram(
6+
clock,
7+
wren1,
8+
wren2,
9+
address,
10+
address2,
11+
value_in,
12+
value_in2,
13+
spram_out,
14+
dpram_out,
15+
dpram_out2,
16+
dpram2_out,
17+
dpram2_out2
18+
);
19+
20+
// SIGNAL DECLARATIONS
21+
input clock;
22+
23+
input wren1;
24+
input wren2;
25+
26+
input [`WIDTH-1:0] value_in;
27+
input [`WIDTH-1:0] value_in2;
28+
29+
output [`WIDTH-1:0] spram_out;
30+
output [`WIDTH-1:0] dpram_out;
31+
output [`WIDTH-1:0] dpram_out2;
32+
output [`WIDTH-1:0] dpram2_out;
33+
output [`WIDTH-1:0] dpram2_out2;
34+
35+
36+
input [`DEPTH-1:0] address;
37+
input [`DEPTH-1:0] address2;
38+
39+
dual_port_ram inst1(
40+
.we1(wren1),
41+
.we2(wren2),
42+
.clk(clock),
43+
.data1(value_in),
44+
.data2(value_in2),
45+
.out1(dpram_out),
46+
.out2(dpram_out2),
47+
.addr1(address),
48+
.addr2(address2)
49+
);
50+
51+
dual_port_ram inst2(
52+
.we1(wren1),
53+
.we2(1'b0),
54+
.clk(clock),
55+
.data1(value_in),
56+
.data2(value_in2),
57+
.out1(dpram2_out),
58+
.out2(dpram2_out2),
59+
.addr1(address),
60+
.addr2(address2)
61+
);
62+
63+
single_port_ram inst1(
64+
.we(wren1),
65+
.clk(clock),
66+
.data(value_in),
67+
.out(spram_out),
68+
.addr(address)
69+
);
70+
71+
endmodule
72+

0 commit comments

Comments
 (0)