aboutsummaryrefslogtreecommitdiffstats
path: root/icetime
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-02-29 10:53:29 +0100
committerClifford Wolf <clifford@clifford.at>2016-02-29 10:53:29 +0100
commit0ac6a3545a17b860ed5a5bf6fcc8303418b25e5a (patch)
treec591183c443deb97e7621f4c9d30501814562fd4 /icetime
parent43e77416362f57e4dbc3ac7cb8049ab3a427130f (diff)
downloadicestorm-0ac6a3545a17b860ed5a5bf6fcc8303418b25e5a.tar.gz
icestorm-0ac6a3545a17b860ed5a5bf6fcc8303418b25e5a.tar.bz2
icestorm-0ac6a3545a17b860ed5a5bf6fcc8303418b25e5a.zip
Fixed make_lc40 with y=0 bug #32
Diffstat (limited to 'icetime')
-rw-r--r--icetime/icetime.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/icetime/icetime.cc b/icetime/icetime.cc
index 69b9d9f..dd4fdad 100644
--- a/icetime/icetime.cc
+++ b/icetime/icetime.cc
@@ -985,6 +985,8 @@ std::string make_seg_pre_io(int x, int y, int z)
std::string make_lc40(int x, int y, int z)
{
+ assert(0 < x && 0 < y && 0 <= z && z < 8);
+
auto cell = stringf("lc40_%d_%d_%d", x, y, z);
if (netlist_cell_types.count(cell))
@@ -1022,7 +1024,7 @@ std::string make_lc40(int x, int y, int z)
{
if (z == 0)
{
- auto co_cell = make_lc40(x, y-1, 7);
+ auto co_cell = 1 < y ? make_lc40(x, y-1, 7) : std::string();
std::string n1, n2;
char cinit_1 = config_bits[x][y][1][49] ? '1' : '0';
@@ -1034,6 +1036,7 @@ std::string make_lc40(int x, int y, int z)
n1 = net_name(x_y_name_net.at(key));
} else {
n1 = tname();
+ assert(!co_cell.empty());
netlist_cell_ports[co_cell]["carryout"] = n1;
extra_wires.insert(n1);
}