mirror of https://github.com/YosysHQ/yosys.git
cxxrtl: Fix value::shl
This commit is contained in:
parent
1c8e58a736
commit
ff53f3d2b6
1
Makefile
1
Makefile
|
@ -888,6 +888,7 @@ endif
|
|||
+cd tests/verilog && bash run-test.sh
|
||||
+cd tests/xprop && bash run-test.sh $(SEEDOPT)
|
||||
+cd tests/fmt && bash run-test.sh
|
||||
+cd tests/cxxrtl && bash run-test.sh
|
||||
@echo ""
|
||||
@echo " Passed \"make test\"."
|
||||
@echo ""
|
||||
|
|
|
@ -419,6 +419,7 @@ struct value : public expr_base<value<Bits>> {
|
|||
carry = (shift_bits == 0) ? 0
|
||||
: data[n] >> (chunk::bits - shift_bits);
|
||||
}
|
||||
result.data[result.chunks - 1] &= result.msb_mask;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
cxxrtl-test-*
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
run_subtest () {
|
||||
local subtest=$1; shift
|
||||
|
||||
${CC:-gcc} -std=c++11 -o cxxrtl-test-${subtest} -I../../backends/cxxrtl/runtime test_${subtest}.cc -lstdc++
|
||||
./cxxrtl-test-${subtest}
|
||||
}
|
||||
|
||||
run_subtest value
|
|
@ -0,0 +1,15 @@
|
|||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
#include "cxxrtl/cxxrtl.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
// shl exceeding Bits should be masked
|
||||
cxxrtl::value<6> a(1u);
|
||||
cxxrtl::value<6> b(8u);
|
||||
cxxrtl::value<6> c = a.shl(b);
|
||||
assert(c.get<uint64_t>() == 0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue