diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-02-16 17:14:53 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-02-16 17:14:53 +0100 |
commit | 56a6d968b646f60d8c248b9838455431382081ea (patch) | |
tree | caacc116eb4808f6ba01111117bf53c91cbfefdd | |
parent | ecf716c5510cd3b4f0006ba4ff074107e76d88ba (diff) | |
download | ghdl-yosys-plugin-56a6d968b646f60d8c248b9838455431382081ea.tar.gz ghdl-yosys-plugin-56a6d968b646f60d8c248b9838455431382081ea.tar.bz2 ghdl-yosys-plugin-56a6d968b646f60d8c248b9838455431382081ea.zip |
Testcase for issue #7
-rw-r--r-- | testsuite/issue7/ref.vhdl | 13 | ||||
-rwxr-xr-x | testsuite/issue7/testsuite.sh | 23 | ||||
-rw-r--r-- | testsuite/issue7/vector.vhdl | 29 | ||||
-rw-r--r-- | testsuite/testenv.sh | 7 |
4 files changed, 71 insertions, 1 deletions
diff --git a/testsuite/issue7/ref.vhdl b/testsuite/issue7/ref.vhdl new file mode 100644 index 0000000..63dc225 --- /dev/null +++ b/testsuite/issue7/ref.vhdl @@ -0,0 +1,13 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity vector is + port (led0, led1, led2, led3, led4, led5, led6, led7: out std_logic); +end vector; + +architecture ref of vector is + signal v : std_logic_vector(7 downto 0); +begin + -- It works ok + (led7, led6, led5, led4, led3, led2, led1, led0) <= std_logic_vector'("10101010"); +end; diff --git a/testsuite/issue7/testsuite.sh b/testsuite/issue7/testsuite.sh new file mode 100755 index 0000000..939f28a --- /dev/null +++ b/testsuite/issue7/testsuite.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +. ../testenv.sh + +analyze ref.vhdl +run_yosys -q -p "ghdl vector ref; write_verilog ref.v" + +analyze vector.vhdl +run_yosys -q -p "ghdl vector synth; write_verilog vector.v" + +run_yosys -p ' + read_verilog ref.v + rename vector ref + + read_verilog vector.v + equiv_make ref vector equiv + + hierarchy -top equiv + equiv_simple + equiv_status -assert' + +clean +rm -f *.v diff --git a/testsuite/issue7/vector.vhdl b/testsuite/issue7/vector.vhdl new file mode 100644 index 0000000..3ab2e24 --- /dev/null +++ b/testsuite/issue7/vector.vhdl @@ -0,0 +1,29 @@ +architecture synth of vector is + +signal v : std_logic_vector(7 downto 0); + +begin + + -- It works ok + --(led7, led6, led5, led4, led3, led2, led1, led0) <= std_logic_vector'("10101010"); + + -- It is assigned in reverse order (led7 should be MSB, but it is assigned + -- the lsb. led0 should be the lsb, but is assigned as the MSB) + v <= std_logic_vector'("10101010"); + led7 <= v(7); + led6 <= v(6); + led5 <= v(5); + led4 <= v(4); + led3 <= v(3); + led2 <= v(2); + led1 <= v(1); + led0 <= v(0); + +end synth; + +architecture ok of vector is + signal v : std_logic_vector(7 downto 0); +begin + -- It works ok + (led7, led6, led5, led4, led3, led2, led1, led0) <= std_logic_vector'("10101010"); +end ok; diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh index 25ff30c..e5775b5 100644 --- a/testsuite/testenv.sh +++ b/testsuite/testenv.sh @@ -16,6 +16,11 @@ cmd () "$@" } +run_yosys () +{ + cmd "$YOSYS" -Q "$@" +} + analyze () { echo "analyze $@" @@ -25,7 +30,7 @@ analyze () synth () { echo "synthesize $@" - cmd "$YOSYS" -Q -q -p "ghdl $@; synth_ice40 -blif out.blif" + run_yosys -q -p "ghdl $@; synth_ice40 -blif out.blif" } clean () |