forked from ghdl/ghdl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite/gna: add a test for ghdl#2584
Close ghdl#2584
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
|
||
entity StreamRegSlice is | ||
generic ( | ||
type DAT | ||
); | ||
port ( | ||
rxcDat_i : in DAT; | ||
txcDat_o : out DAT | ||
); | ||
end StreamRegSlice; | ||
|
||
architecture rtl of StreamRegSlice is | ||
begin | ||
txcDat_o <= rxcDat_i; | ||
end rtl; | ||
|
||
|
||
use std.env.all; | ||
|
||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
entity StreamTb is | ||
generic ( | ||
WIDTH : positive := 8 | ||
); | ||
end StreamTb; | ||
|
||
architecture behavior of StreamTb is | ||
subtype DAT is std_logic_vector(WIDTH-1 downto 0); | ||
signal txcDat : DAT; | ||
signal rxcDat : DAT; | ||
begin | ||
|
||
-- DUT instance | ||
dut : entity work.StreamRegSlice | ||
generic map ( | ||
DAT => DAT | ||
) | ||
port map ( | ||
rxcDat_i => txcDat, | ||
txcDat_o => rxcDat | ||
); | ||
-- rxcDat <= txcDat; | ||
|
||
p_test : process | ||
begin | ||
-- end simulation | ||
for i in 0 to 8-1 loop | ||
txcDat <= std_logic_vector(to_unsigned(i, WIDTH)); | ||
wait for 10 ns; | ||
end loop; | ||
report "Simulation end"; | ||
finish; | ||
end process p_test; | ||
|
||
end behavior; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /bin/sh | ||
|
||
. ../../testenv.sh | ||
|
||
export GHDL_STD_FLAGS=--std=08 | ||
|
||
if ghdl_is_preelaboration; then | ||
analyze streamtb.vhdl | ||
elab_simulate streamtb | ||
clean | ||
fi | ||
|
||
|
||
echo "Test successful" |