Skip to content

Commit 4cecbcb

Browse files
committed
add picorv test to functional backend
1 parent 611dd25 commit 4cecbcb

File tree

5 files changed

+3135
-2
lines changed

5 files changed

+3135
-2
lines changed

kernel/functional.cc

+15-2
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ class FunctionalIRConstruction {
530530
memories[mem.cell] = &mem;
531531
}
532532
}
533+
private:
533534
Node concatenate_read_results(Mem *mem, vector<Node> results)
534535
{
535536
// sanity check: all read ports concatenated should equal to the RD_DATA port
@@ -632,6 +633,17 @@ class FunctionalIRConstruction {
632633
}
633634
}
634635
}
636+
void undriven(const char *name) {
637+
log_error("The design contains an undriven signal %s. This is not supported by the functional backend. "
638+
"Call setundef with appropriate options to avoid this error.\n", name);
639+
}
640+
// we perform this check separately to give better error messages that include the wire or port name
641+
void check_undriven(DriveSpec const& spec, std::string const& name) {
642+
for(auto const &chunk : spec.chunks())
643+
if(chunk.is_none())
644+
undriven(name.c_str());
645+
}
646+
public:
635647
void process_queue()
636648
{
637649
for (; !queue.empty(); queue.pop_front()) {
@@ -660,6 +672,7 @@ class FunctionalIRConstruction {
660672
factory.update_pending(pending, node);
661673
} else {
662674
DriveSpec driver = driver_map(DriveSpec(wire_chunk));
675+
check_undriven(driver, RTLIL::unescape_id(wire_chunk.wire->name));
663676
Node node = enqueue(driver);
664677
factory.suggest_name(node, wire_chunk.wire->name);
665678
factory.update_pending(pending, node);
@@ -677,6 +690,7 @@ class FunctionalIRConstruction {
677690
factory.update_pending(pending, node);
678691
} else {
679692
DriveSpec driver = driver_map(DriveSpec(port_chunk));
693+
check_undriven(driver, RTLIL::unescape_id(port_chunk.cell->name) + " port " + RTLIL::unescape_id(port_chunk.port));
680694
factory.update_pending(pending, enqueue(driver));
681695
}
682696
} else {
@@ -692,8 +706,7 @@ class FunctionalIRConstruction {
692706
log_error("Signal %s has multiple drivers. This is not supported by the functional backend. "
693707
"If tristate drivers are used, call tristate -formal to avoid this error.\n", log_signal(chunk));
694708
} else if (chunk.is_none()) {
695-
log_error("The design contains an undriven signal %s. This is not supported by the functional backend. "
696-
"Call setundef with appropriate options to avoid this error.\n", log_signal(chunk));
709+
undriven(log_signal(chunk));
697710
} else {
698711
log_error("unhandled drivespec: %s\n", log_signal(chunk));
699712
log_abort();

0 commit comments

Comments
 (0)