Skip to content

Commit

Permalink
tests: Add channel test
Browse files Browse the repository at this point in the history
Add simple channel test. Disable it for testing with the machine code
compiler pending the compiler getting support for channels.

Signed-off-by: Martin Povišer <[email protected]>
  • Loading branch information
povik committed Jan 3, 2024
1 parent 852753d commit 4a027d3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test: build/fold.so
fi \
done
@echo "Target: logic"
@for testcase in tests/programs/*.fold; \
@for testcase in tests/programs/*.fold tests/programs/*.fold.disabled_mcode; \
do \
echo -n "$${testcase}... "; \
if ! $(YOSYS) -m $(TARGET_PLUGIN_LIB) -m fold.logic.frontend.py -p "read_fold $${testcase}; fold_synth; read_verilog -sv support/mutex_assert.sv; hierarchy -top top; proc; memory_nordff; sim -n 100 -assert -clock clk -reset rst" 1>/dev/null 2>&1; then \
Expand Down
34 changes: 34 additions & 0 deletions tests/programs/chan1.fold.disabled_mcode
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
chan g (data [8] signed) (databack [8])

var v [16] mut signed;
fork partner;

` wait.
v = g<-(0xaa);
assert_equal(v, -2);
` wait.
v = g<-(0x55);
assert_equal(v, -4);
` wait.
v = g<-(0);
assert_equal(v, 6);

quit;
partner:

var j [2] mut;
j = 2;
for j {
j = j - 1;
delay(1);
}

` wait.
v = g->(-2);
assert_equal(v, 0xaa);
` wait.
v = g->(-4);
assert_equal(v, 0x55);
` wait.
v = g->(6);
assert_equal(v, 0);

0 comments on commit 4a027d3

Please sign in to comment.