3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-27 07:49:50 +00:00

tests/memfile: Test dump_meminit

Change tests/memfile to a mktest, moving the prior run-test.sh contents into a new read_dir.sh.
Add dump.ys (and friends) for testing dump_meminit.
This commit is contained in:
Krystine Sherwin 2025-11-14 11:47:40 +13:00
parent 7d79c11ca9
commit 3787ea19cd
No known key found for this signature in database
7 changed files with 152 additions and 49 deletions

49
tests/memfile/read_dir.sh Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -e
mkdir -p temp
cp content1.dat temp/content2.dat
cd ..
echo "Running from the parent directory with content1.dat"
../yosys -qp "read_verilog -defer memfile/memory.v; chparam -set MEMFILE \"content1.dat\" memory"
echo "Running from the parent directory with temp/content2.dat"
../yosys -qp "read_verilog -defer memfile/memory.v; chparam -set MEMFILE \"temp/content2.dat\" memory"
echo "Running from the parent directory with memfile/temp/content2.dat"
../yosys -qp "read_verilog -defer memfile/memory.v; chparam -set MEMFILE \"memfile/temp/content2.dat\" memory"
cd memfile
echo "Running from the same directory with content1.dat"
../../yosys -qp "read_verilog -defer memory.v; chparam -set MEMFILE \"content1.dat\" memory"
echo "Running from the same directory with temp/content2.dat"
../../yosys -qp "read_verilog -defer memory.v; chparam -set MEMFILE \"temp/content2.dat\" memory"
cd temp
echo "Running from a child directory with content1.dat"
../../../yosys -qp "read_verilog -defer ../memory.v; chparam -set MEMFILE \"content1.dat\" memory"
echo "Running from a child directory with temp/content2.dat"
../../../yosys -qp "read_verilog -defer ../memory.v; chparam -set MEMFILE \"temp/content2.dat\" memory"
echo "Running from a child directory with content2.dat"
../../../yosys -qp "read_verilog -defer ../memory.v; chparam -set MEMFILE \"temp/content2.dat\" memory"
cd ..
echo "Checking a failure when zero length filename is provided"
if ../../yosys -qp "read_verilog memory.v"; then
echo "The execution should fail but it didn't happen, which is WRONG."
exit 1
else
echo "Execution failed, which is OK."
fi
echo "Checking a failure when not existing filename is provided"
if ../../yosys -qp "read_verilog -defer memory.v; chparam -set MEMFILE \"content3.dat\" memory"; then
echo "The execution should fail but it didn't happen, which is WRONG."
exit 1
else
echo "Execution failed, which is OK."
fi