Skip to content

Commit

Permalink
fix bug for mask of >32bit ports
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reese committed Nov 16, 2023
1 parent 7d06bdf commit 0ab826c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gvi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ std::string cpp_verilator_interface_function_definition_in(const std::string &mo
out << "\t}" << std::endl;
} else if (port.bitsize <= 64) {
out << "\tvoid " << function_name_prefix(modulename) << port.name << "(int idx, int " << port.name << "_gvi_lo, int " << port.name << "_gvi_hi" << ") {" << std::endl;
out << "\t\t" << modulename << "_top_instances[idx]->" << port.name_orig << " = " << gen_mask(port.bitsize) << " & (unsigned)" << port.name << "_gvi_hi;" << std::endl;
out << "\t\t" << modulename << "_top_instances[idx]->" << port.name_orig << " = " << gen_mask(port.bitsize-32) << " & (unsigned)" << port.name << "_gvi_hi;" << std::endl;
out << "\t\t" << modulename << "_top_instances[idx]->" << port.name_orig << " <<= 32;" << std::endl;
out << "\t\t" << modulename << "_top_instances[idx]->" << port.name_orig << " |= (unsigned)" << port.name << "_gvi_lo;" << std::endl;
out << "\t}" << std::endl;
Expand Down

0 comments on commit 0ab826c

Please sign in to comment.