Skip to content
Snippets Groups Projects
Commit 4b6bf3b2 authored by Jacob Wahlman's avatar Jacob Wahlman :ok_hand:
Browse files

merge w/ develop

parents 4b0087b5 79c5a170
No related branches found
No related tags found
1 merge request!61Fixed save/load, sfg creating, simulation, bug fixes
Pipeline #16250 passed
......@@ -204,8 +204,8 @@ private:
if (bits > 64) {
throw py::value_error{"Cannot truncate to more than 64 bits"};
}
this->add_instruction(instruction_type::truncate, no_result_index, 0).bit_mask = static_cast<std::int64_t>(std::int64_t{1}
<< bits);
this->add_instruction(instruction_type::truncate, no_result_index, 0).bit_mask = static_cast<std::int64_t>(
(std::int64_t{1} << bits) - 1);
}
}
......
......@@ -31,7 +31,7 @@ namespace asic {
if (*bits_override > 64) {
throw py::value_error{"Cannot truncate to more than 64 bits"};
}
return static_cast<std::int64_t>(std::int64_t{1} << *bits_override); // Return the bit mask override to use.
return static_cast<std::int64_t>((std::int64_t{1} << *bits_override) - 1); // Return the bit mask override to use.
}
bits_override.reset(); // Don't use bits_override if truncate is false.
return std::int64_t{};
......
......@@ -122,6 +122,12 @@ class TestRunFor:
assert simulation.results["0"][4] == -6
assert simulation.results["0"][5] == 7
def test_find_result_key(self, precedence_sfg_delays):
sim = FastSimulation(precedence_sfg_delays, [[0, 4, 542, 42, 31.314, 534.123, -453415, 5431]])
sim.run()
assert sim.results[precedence_sfg_delays.find_result_keys_by_name("ADD2")[0]][4] == 31220
assert sim.results[precedence_sfg_delays.find_result_keys_by_name("A1")[0]][2] == 80
class TestRun:
def test_save_results(self, sfg_two_inputs_two_outputs):
simulation = FastSimulation(sfg_two_inputs_two_outputs, [2, 3])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment