summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-12-31 14:54:06 +0100
committerClifford Wolf <clifford@clifford.at>2013-12-31 14:54:06 +0100
commit15acf593e707c6666459c0cfd121a5f0fc996571 (patch)
treeb103ee7e3286e88318e23cd472e2a8b521f30c93 /kernel
parent1cd975ef8de889bf7f51ea108fcb8df878c906df (diff)
Added additional checks for A_SIGNED == B_SIGNED for cells with that constraint
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rtlil.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index b8c9e21a..4916ca72 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -337,7 +337,7 @@ namespace {
expected_ports.insert(name);
}
- void check_expected()
+ void check_expected(bool check_matched_sign = true)
{
for (auto &para : cell->parameters)
if (expected_params.count(para.first) == 0)
@@ -345,6 +345,13 @@ namespace {
for (auto &conn : cell->connections)
if (expected_ports.count(conn.first) == 0)
error(__LINE__);
+
+ if (expected_params.count("\\A_SIGNED") != 0 && expected_params.count("\\B_SIGNED") && check_matched_sign) {
+ bool a_is_signed = param("\\A_SIGNED") != 0;
+ bool b_is_signed = param("\\B_SIGNED") != 0;
+ if (a_is_signed != b_is_signed)
+ error(__LINE__);
+ }
}
void check_gate(const char *ports)
@@ -403,7 +410,7 @@ namespace {
port("\\A", param("\\A_WIDTH"));
port("\\B", param("\\B_WIDTH"));
port("\\Y", param("\\Y_WIDTH"));
- check_expected();
+ check_expected(false);
return;
}
@@ -425,7 +432,7 @@ namespace {
port("\\A", param("\\A_WIDTH"));
port("\\B", param("\\B_WIDTH"));
port("\\Y", param("\\Y_WIDTH"));
- check_expected();
+ check_expected(cell->type != "$pow");
return;
}
@@ -443,7 +450,7 @@ namespace {
port("\\A", param("\\A_WIDTH"));
port("\\B", param("\\B_WIDTH"));
port("\\Y", param("\\Y_WIDTH"));
- check_expected();
+ check_expected(false);
return;
}