Skip to content

Commit 0802836

Browse files
authored
Merge pull request verilog-to-routing#3 from litghost/fasm_output
Initial FASM output from VPR
2 parents 68aae30 + aee0f2f commit 0802836

22 files changed

+1076
-39
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ install:
4747
- ./.travis/install.sh
4848

4949
script:
50+
- while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done &
5051
- ./.travis/script.sh
5152

5253
after_failure:

.travis/script.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,3 @@ start_section "vtr.test.3" "${GREEN}Testing..${NC} ${CYAN}vtr_reg_valgrind_small
4444
end_section "vtr.test.3"
4545

4646
$SPACER
47-
48-
start_section "vtr.test.4" "${GREEN}Testing..${NC} ${CYAN}odin_reg_micro${NC}"
49-
./run_reg_test.pl odin_reg_micro
50-
end_section "vtr.test.4"
51-
52-
$SPACER

libs/EXTERNAL/libtatum/libtatum/tatum/TimingGraph.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,9 @@ bool TimingGraph::validate_structure() const {
643643
if(in_edges.size() == 0 && !allow_dangling_combinational_nodes_) {
644644
throw tatum::Error("IPIN has no in-coming edges");
645645
}
646-
if(out_edges.size() == 0 && !allow_dangling_combinational_nodes_) {
647-
throw tatum::Error("IPIN has no out-going edges");
648-
}
646+
//if(out_edges.size() == 0 && !allow_dangling_combinational_nodes_) {
647+
// throw tatum::Error("IPIN has no out-going edges");
648+
//}
649649
} else if (src_type == NodeType::OPIN) {
650650
//May have no incoming edges if a constant generator, so don't check that case
651651

libs/libarchfpga/src/physical_types.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,36 +109,37 @@ class t_metadata_as {
109109

110110
struct t_metadata_dict : std::unordered_map<std::pair<t_offset, std::string>, std::vector<t_metadata_as> > {
111111

112-
inline bool has(std::string key) {
112+
inline bool has(std::string key) const {
113113
return has(std::make_pair(t_offset(), key));
114114
}
115-
inline bool has(t_offset o, std::string key) {
115+
inline bool has(t_offset o, std::string key) const {
116116
return has(std::make_pair(o, key));
117117
}
118-
inline bool has(std::pair<t_offset, std::string> ok) {
118+
inline bool has(std::pair<t_offset, std::string> ok) const {
119119
return (this->count(ok) >= 1);
120120
}
121121

122-
inline std::vector<t_metadata_as>* get(std::string key) {
122+
inline const std::vector<t_metadata_as>* get(std::string key) const {
123123
return get(std::make_pair(t_offset(), key));
124124
}
125-
inline std::vector<t_metadata_as>* get(t_offset o, std::string key) {
125+
inline const std::vector<t_metadata_as>* get(t_offset o, std::string key) const {
126126
return get(std::make_pair(o, key));
127127
}
128-
inline std::vector<t_metadata_as>* get(std::pair<t_offset, std::string> ok) {
129-
if (this->count(ok) < 1) {
130-
return nullptr;
128+
inline const std::vector<t_metadata_as>* get(std::pair<t_offset, std::string> ok) const {
129+
auto iter = this->find(ok);
130+
if(iter != this->end()) {
131+
return &iter->second;
131132
}
132-
return &((*this)[ok]);
133+
return nullptr;
133134
}
134135

135-
inline t_metadata_as* one(std::string key) {
136+
inline const t_metadata_as* one(std::string key) const {
136137
return one(std::make_pair(t_offset(), key));
137138
}
138-
inline t_metadata_as* one(t_offset o, std::string key) {
139+
inline const t_metadata_as* one(t_offset o, std::string key) const {
139140
return one(std::make_pair(o, key));
140141
}
141-
inline t_metadata_as* one(std::pair<t_offset, std::string> ok) {
142+
inline const t_metadata_as* one(std::pair<t_offset, std::string> ok) const {
142143
auto values = get(ok);
143144
if (values == nullptr) {
144145
return nullptr;
@@ -363,6 +364,7 @@ struct t_grid_loc_def {
363364

364365
t_grid_loc_spec x; //Horizontal location specification
365366
t_grid_loc_spec y; //Veritcal location specification
367+
t_metadata_dict *meta;
366368
};
367369

368370
enum GridDefType {
@@ -760,6 +762,7 @@ struct t_interconnect {
760762
t_mode *parent_mode;
761763

762764
t_interconnect_power *interconnect_power;
765+
t_metadata_dict *meta = nullptr;
763766
};
764767

765768
/** Describes I/O and clock ports

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,7 @@ static void ProcessInterconnect(pugi::xml_node Parent, t_mode * mode, const pugi
15121512

15131513
Prop = get_attribute(Cur, "name", loc_data).value();
15141514
mode->interconnect[i].name = vtr::strdup(Prop);
1515+
mode->interconnect[i].meta = ProcessMetadata(Cur, loc_data);
15151516

15161517
ret_interc_names = interc_names.insert(
15171518
pair<string, int>(mode->interconnect[i].name, 0));
@@ -2272,6 +2273,7 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
22722273
auto loc_type = loc_spec_tag.name();
22732274
auto type_name = get_attribute(loc_spec_tag, "type", loc_data).value();
22742275
int priority = get_attribute(loc_spec_tag, "priority", loc_data).as_int();
2276+
auto *meta = ProcessMetadata(loc_spec_tag, loc_data);
22752277

22762278
if (loc_type == std::string("perimeter")) {
22772279
expect_only_attributes(loc_spec_tag, {"type", "priority"}, loc_data);
@@ -2282,24 +2284,28 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
22822284
left_edge.x.end_expr = "0";
22832285
left_edge.y.start_expr = "0";
22842286
left_edge.y.end_expr = "H - 1";
2287+
left_edge.meta = meta;
22852288

22862289
t_grid_loc_def right_edge(type_name, priority); //Including corners
22872290
right_edge.x.start_expr = "W - 1";
22882291
right_edge.x.end_expr = "W - 1";
22892292
right_edge.y.start_expr = "0";
22902293
right_edge.y.end_expr = "H - 1";
2294+
right_edge.meta = meta;
22912295

22922296
t_grid_loc_def bottom_edge(type_name, priority); //Exclucing corners
22932297
bottom_edge.x.start_expr = "1";
22942298
bottom_edge.x.end_expr = "W - 2";
22952299
bottom_edge.y.start_expr = "0";
22962300
bottom_edge.y.end_expr = "0";
2301+
bottom_edge.meta = meta;
22972302

22982303
t_grid_loc_def top_edge(type_name, priority); //Excluding corners
22992304
top_edge.x.start_expr = "1";
23002305
top_edge.x.end_expr = "W - 2";
23012306
top_edge.y.start_expr = "H - 1";
23022307
top_edge.y.end_expr = "H - 1";
2308+
top_edge.meta = meta;
23032309

23042310
grid_def.loc_defs.push_back(left_edge);
23052311
grid_def.loc_defs.push_back(right_edge);
@@ -2315,24 +2321,28 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
23152321
bottom_left.x.end_expr = "0";
23162322
bottom_left.y.start_expr = "0";
23172323
bottom_left.y.end_expr = "0";
2324+
bottom_left.meta = meta;
23182325

23192326
t_grid_loc_def top_left(type_name, priority);
23202327
top_left.x.start_expr = "0";
23212328
top_left.x.end_expr = "0";
23222329
top_left.y.start_expr = "H-1";
23232330
top_left.y.end_expr = "H-1";
2331+
top_left.meta = meta;
23242332

23252333
t_grid_loc_def bottom_right(type_name, priority);
23262334
bottom_right.x.start_expr = "W-1";
23272335
bottom_right.x.end_expr = "W-1";
23282336
bottom_right.y.start_expr = "0";
23292337
bottom_right.y.end_expr = "0";
2338+
bottom_right.meta = meta;
23302339

23312340
t_grid_loc_def top_right(type_name, priority);
23322341
top_right.x.start_expr = "W-1";
23332342
top_right.x.end_expr = "W-1";
23342343
top_right.y.start_expr = "H-1";
23352344
top_right.y.end_expr = "H-1";
2345+
top_right.meta = meta;
23362346

23372347
grid_def.loc_defs.push_back(bottom_left);
23382348
grid_def.loc_defs.push_back(top_left);
@@ -2347,6 +2357,7 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
23472357
fill.x.end_expr = "W - 1";
23482358
fill.y.start_expr = "0";
23492359
fill.y.end_expr = "H - 1";
2360+
fill.meta = meta;
23502361

23512362
grid_def.loc_defs.push_back(fill);
23522363

@@ -2358,6 +2369,7 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
23582369
single.y.start_expr = get_attribute(loc_spec_tag, "y", loc_data).value();
23592370
single.x.end_expr = single.x.start_expr + " + w - 1";
23602371
single.y.end_expr = single.y.start_expr + " + h - 1";
2372+
single.meta = meta;
23612373

23622374
grid_def.loc_defs.push_back(single);
23632375

@@ -2385,6 +2397,7 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
23852397
if (incry_attr) {
23862398
col.y.incr_expr = incry_attr.value();
23872399
}
2400+
col.meta = meta;
23882401

23892402
grid_def.loc_defs.push_back(col);
23902403

@@ -2412,6 +2425,7 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
24122425
if (incrx_attr) {
24132426
row.x.incr_expr = incrx_attr.value();
24142427
}
2428+
row.meta = meta;
24152429

24162430
grid_def.loc_defs.push_back(row);
24172431
} else if (loc_type == std::string("region")) {
@@ -2461,6 +2475,7 @@ static t_grid_def ProcessGridLayout(pugi::xml_node layout_type_tag, const pugiut
24612475
if (incry_attr) {
24622476
region.y.incr_expr = incry_attr.value();
24632477
}
2478+
region.meta = meta;
24642479

24652480
grid_def.loc_defs.push_back(region);
24662481
} else {

utils/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
add_subdirectory(hlc)
2+
add_subdirectory(fasm)

utils/fasm/CMakeLists.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cmake_minimum_required(VERSION 2.8.12)
2+
3+
project("genfasm")
4+
5+
#Create library
6+
add_library(fasm
7+
src/fasm.cpp
8+
src/fasm.h
9+
src/lut.cpp
10+
src/lut.h
11+
)
12+
target_include_directories(fasm PUBLIC src)
13+
target_link_libraries(fasm
14+
libvpr
15+
libvtrutil
16+
libarchfpga
17+
libsdcparse
18+
libblifparse
19+
libeasygl
20+
libtatum
21+
libargparse
22+
libpugixml)
23+
24+
add_executable(genfasm src/main.cpp)
25+
target_link_libraries(genfasm fasm)
26+
27+
#Specify link-time dependancies
28+
install(TARGETS fasm DESTINATION bin)
29+
30+
#
31+
# Unit Tests
32+
#
33+
set(TEST_SOURCES
34+
test/main.cpp
35+
test/test_fasm.cpp
36+
)
37+
add_executable(test_fasm ${TEST_SOURCES})
38+
target_link_libraries(test_fasm fasm libcatch)
39+
40+
add_test(
41+
NAME test_fasm
42+
COMMAND test_fasm --use-colour=yes)

0 commit comments

Comments
 (0)