Skip to content

Commit

Permalink
Fix corner case of pos cell with input and output being same width
Browse files Browse the repository at this point in the history
  • Loading branch information
RCoeurjoly committed Jul 7, 2024
1 parent 73e39b3 commit 3dad680
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backends/functional/smtlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ struct SmtModule {
SmtModule(const std::string &module_name, FunctionalIR ir) : name(module_name), ir(std::move(ir)) {}

void write(std::ostream &out)
{
{
const bool stateful = ir.state().size() != 0;
SmtWriter writer(out);

Expand Down Expand Up @@ -371,6 +371,8 @@ struct SmtModule {
for (size_t i = 0; i < ir.size() - ir.inputs().size(); ++i) {
writer.print(" )"); // Closing each node
}
if (ir.size() == ir.inputs().size())
writer.print(" )"); // Corner case

writer.print(" )"); // Closing inputs let statement
writer.print(")\n"); // Closing step function
Expand Down
13 changes: 13 additions & 0 deletions tests/functional/single_cells/rtlil/test_cell_pos_00001.il
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Yosys 0.40+7 (git sha1 d8b5b90e7, g++ 13.2.0 -Og -fPIC)
autoidx 1
module \gold
wire width 6 input 1 \A
wire width 6 output 2 \Y
cell $pos \UUT
parameter \A_SIGNED 0
parameter \A_WIDTH 6
parameter \Y_WIDTH 6
connect \A \A
connect \Y \Y
end
end

0 comments on commit 3dad680

Please sign in to comment.