Skip to content

Commit 06da883

Browse files
Fixed Odin Build Failures
1 parent 96f3f13 commit 06da883

File tree

5 files changed

+22
-29
lines changed

5 files changed

+22
-29
lines changed

odin_ii/src/core/adders.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <cstdio>
2727
#include <cstring>
2828

29+
#include "logic_types.h"
2930
#include "odin_types.h"
3031
#include "odin_util.h"
3132
#include "node_creation_library.h"
@@ -107,17 +108,18 @@ void report_add_distribution() {
107108
* (function: find_hard_adders)
108109
*-------------------------------------------------------------------------*/
109110
void find_hard_adders() {
110-
hard_adders = Arch.models;
111111
//Disable the size in configuration file.(The threshold for the extra bits).
112112
//min_add = configuration.min_hard_adder;
113113
min_threshold_adder = configuration.min_threshold_adder;
114114

115-
while (hard_adders != NULL) {
115+
hard_adders = NULL;
116+
for (LogicalModelId model_id : Arch.models.user_models()) {
117+
hard_adders = &Arch.models.get_model(model_id);
116118
if (strcmp(hard_adders->name, "adder") == 0) {
117119
init_add_distribution();
118120
return;
119121
} else {
120-
hard_adders = hard_adders->next;
122+
hard_adders = NULL;
121123
}
122124
}
123125

odin_ii/src/core/hard_blocks.cpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <cstdio>
2727
#include <cstring>
2828

29+
#include "logic_types.h"
2930
#include "odin_types.h"
3031
#include "odin_util.h"
3132
#include "odin_globals.h"
@@ -55,14 +56,11 @@ t_model_ports* get_model_port(t_model_ports* ports, const char* name) {
5556
}
5657

5758
void cache_hard_block_names() {
58-
t_model* hard_blocks = NULL;
59-
60-
hard_blocks = Arch.models;
6159
hard_block_names = sc_new_string_cache();
62-
while (hard_blocks) {
60+
for (LogicalModelId model_id : Arch.models.user_models()) {
61+
t_model* hard_blocks = &Arch.models.get_model(model_id);
6362
int sc_spot = sc_add_string(hard_block_names, hard_blocks->name);
6463
hard_block_names->data[sc_spot] = (void*)hard_blocks;
65-
hard_blocks = hard_blocks->next;
6664
}
6765
}
6866

@@ -112,14 +110,9 @@ void deregister_hard_blocks() {
112110
}
113111

114112
t_model* find_hard_block(const char* name) {
115-
t_model* hard_blocks;
116-
117-
hard_blocks = Arch.models;
118-
while (hard_blocks)
119-
if (!strcmp(hard_blocks->name, name))
120-
return hard_blocks;
121-
else
122-
hard_blocks = hard_blocks->next;
113+
LogicalModelId hard_block_model_id = Arch.models.get_model_by_name(name);
114+
if (hard_block_model_id.is_valid())
115+
return &Arch.models.get_model(hard_block_model_id);
123116

124117
return NULL;
125118
}
@@ -208,19 +201,17 @@ void define_hard_block(nnode_t* node, FILE* out) {
208201

209202
void output_hard_blocks(FILE* out) {
210203
t_model_ports* hb_ports;
211-
t_model* hard_blocks;
212204
char buffer[MAX_BUF];
213205
int count;
214206
int i;
215207

216208
oassert(out != NULL);
217-
hard_blocks = Arch.models;
218-
while (hard_blocks != NULL) {
209+
for (LogicalModelId model_id : Arch.models.user_models()) {
210+
t_model* hard_blocks = &Arch.models.get_model(model_id);
219211
if (hard_blocks->used == 1) /* Hard Block is utilized */
220212
{
221213
//IF the hard_blocks is an adder or a multiplier, we ignore it.(Already print out in add_the_blackbox_for_adds and add_the_blackbox_for_mults)
222214
if (strcmp(hard_blocks->name, "adder") == 0 || strcmp(hard_blocks->name, "multiply") == 0) {
223-
hard_blocks = hard_blocks->next;
224215
break;
225216
}
226217

@@ -261,7 +252,6 @@ void output_hard_blocks(FILE* out) {
261252

262253
fprintf(out, "\n.blackbox\n.end\n\n");
263254
}
264-
hard_blocks = hard_blocks->next;
265255
}
266256

267257
return;

odin_ii/src/core/multipliers.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <cmath>
3030
#include <string>
3131

32+
#include "logic_types.h"
3233
#include "odin_types.h"
3334
#include "odin_util.h"
3435
#include "node_creation_library.h"
@@ -297,14 +298,15 @@ void report_mult_distribution() {
297298
* (function: find_hard_multipliers)
298299
*-------------------------------------------------------------------------*/
299300
void find_hard_multipliers() {
300-
hard_multipliers = Arch.models;
301+
hard_multipliers = NULL;
301302
min_mult = configuration.min_hard_multiplier;
302-
while (hard_multipliers != NULL) {
303+
for (LogicalModelId model_id : Arch.models.user_models()) {
304+
hard_multipliers = &Arch.models.get_model(model_id);
303305
if (strcmp(hard_multipliers->name, "multiply") == 0) {
304306
init_mult_distribution();
305307
return;
306308
} else {
307-
hard_multipliers = hard_multipliers->next;
309+
hard_multipliers = NULL;
308310
}
309311
}
310312

odin_ii/src/verilog/verilog_writer.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include <sstream> //std::stringstream
2727

28+
#include "logic_types.h"
2829
#include "verilog.h"
2930
#include "odin_globals.h"
3031
#include "hard_blocks.h"
@@ -59,15 +60,12 @@ void verilog::writer::_write(const netlist_t* netlist) {
5960
}
6061

6162
// print out the rest od models, including DSPs in the target architecture
62-
t_model* model = Arch.models;
63-
64-
while (model) {
63+
for (LogicalModelId model_id : Arch.models.user_models()) {
6564
int sc_spot;
66-
if ((sc_spot = sc_lookup_string(this->models_declaration, model->name)) != -1) {
65+
if ((sc_spot = sc_lookup_string(this->models_declaration, Arch.models.model_name(model_id).c_str())) != -1) {
6766
fprintf(this->output_file, "%s", (char*)this->models_declaration->data[sc_spot]);
6867
fflush(this->output_file);
6968
}
70-
model = model->next;
7169
}
7270
}
7371

parmys/parmys-plugin/core/adder.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ void find_hard_adders()
101101
// min_add = configuration.min_hard_adder;
102102
min_threshold_adder = configuration.min_threshold_adder;
103103

104+
hard_adders = NULL;
104105
for (LogicalModelId model_id : Arch.models.user_models()) {
105106
hard_adders = &Arch.models.get_model(model_id);
106107
if (strcmp(hard_adders->name, "adder") == 0) {

0 commit comments

Comments
 (0)