diff --git a/openfpga/src/fpga_verilog/verilog_testbench_utils.cpp b/openfpga/src/fpga_verilog/verilog_testbench_utils.cpp index 4d19b5e96..4e1b3b1cf 100644 --- a/openfpga/src/fpga_verilog/verilog_testbench_utils.cpp +++ b/openfpga/src/fpga_verilog/verilog_testbench_utils.cpp @@ -156,8 +156,12 @@ void print_verilog_testbench_benchmark_instance(std::fstream& fp, if (bus_id) { fp << "{"; int pin_counter = 0; - /* Include all the pins */ - for (const BusPinId& pin : bus_group.bus_pins(bus_id)) { + /* Include all the pins: If it follows little endian, reverse the pin sequence */ + std::vector bus_pins = bus_group.bus_pins(bus_id); + if (!bus_group.is_big_endian(bus_id)) { + std::reverse(bus_pins.begin(), bus_pins.end()); + } + for (const BusPinId& pin : bus_pins) { if (0 < pin_counter) { fp << ", "; }