Line 1... |
Line 1... |
|
-------------------------------------------------------------------------------
|
|
--
|
|
-- Design: tinyVLIW8 soft-core processor
|
|
-- Author: Oliver Stecklina <stecklina@ihp-microelectronics.com>
|
|
-- Date: 24.10.2013
|
|
-- File: sysArch_tb.vhd
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
--
|
|
-- Description : System architecture testbench. Using a ROM initialized by
|
|
-- ihex file to simplify system tests.
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
--
|
|
-- Copyright (C) 2015 IHP GmbH, Frankfurt (Oder), Germany
|
|
--
|
|
-- This code is free software. It is licensed under the EUPL, Version 1.1
|
|
-- or - as soon they will be approved by the European Commission - subsequent
|
|
-- versions of the EUPL (the "License").
|
|
-- You may redistribute this code and/or modify it under the terms of this
|
|
-- License.
|
|
-- You may not use this work except in compliance with the License.
|
|
-- You may obtain a copy of the License at:
|
|
--
|
|
-- http://joinup.ec.europa.eu/software/page/eupl/licence-eupl
|
|
--
|
|
-- Unless required by applicable law or agreed to in writing, software
|
|
-- distributed under the License is distributed on an "AS IS" basis,
|
|
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
-- See the License for the specific language governing permissions and
|
|
-- limitations under the License.
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
|
library IEEE;
|
library IEEE;
|
use IEEE.std_logic_1164.all;
|
use IEEE.std_logic_1164.all;
|
|
|
entity sysArch_tb is
|
entity sysArch_tb is
|
end sysArch_tb;
|
end sysArch_tb;
|
Line 49... |
Line 83... |
-- reset input
|
-- reset input
|
rst_n : in std_logic
|
rst_n : in std_logic
|
);
|
);
|
end component;
|
end component;
|
|
|
component symDecoder
|
|
port (
|
|
clk : in std_logic;
|
|
|
|
codeA : in std_logic;
|
|
codeB : in std_logic;
|
|
|
|
ioAddr : in std_logic_vector(3 downto 0); -- register address
|
|
ioWriteEn_n : in std_logic; -- write enable, low active
|
|
ioReadEn_n : in std_logic; -- read enable, low active
|
|
|
|
ioDataOut : out std_logic_vector(7 downto 0); -- data bus for writing register
|
|
ioDataIn : in std_logic_vector(7 downto 0); -- data bus for reading register
|
|
|
|
irq : out std_logic;
|
|
irq_ack : in std_logic;
|
|
|
|
rst_n : in std_logic
|
|
);
|
|
end component;
|
|
|
|
component lib_tb_clock32kHz is
|
component lib_tb_clock32kHz is
|
port (
|
port (
|
signal clk : out std_logic;
|
signal clk : out std_logic;
|
signal rst_n : out std_logic
|
signal rst_n : out std_logic
|
);
|
);
|
Line 97... |
Line 110... |
signal dataOut : out std_logic_vector(31 downto 0);
|
signal dataOut : out std_logic_vector(31 downto 0);
|
signal en_n : in std_logic
|
signal en_n : in std_logic
|
);
|
);
|
end component;
|
end component;
|
|
|
component wurCodeGen_tb is
|
|
port (
|
|
clk : in std_logic;
|
|
|
|
pattern : in std_logic_vector(31 downto 0);
|
|
mask : in std_logic_vector(31 downto 0);
|
|
|
|
codeA : out std_logic;
|
|
codeB : out std_logic;
|
|
|
|
finished : out std_logic;
|
|
|
|
rst_n : in std_logic
|
|
);
|
|
end component;
|
|
|
|
component gendelay
|
component gendelay
|
generic (n: integer := 1);
|
generic (n: integer := 1);
|
port (
|
port (
|
a_in : in std_logic;
|
a_in : in std_logic;
|
a_out : out std_logic
|
a_out : out std_logic
|
Line 159... |
Line 156... |
signal spiMiso_s : std_logic := '0';
|
signal spiMiso_s : std_logic := '0';
|
|
|
signal dataInClk_s : std_logic;
|
signal dataInClk_s : std_logic;
|
signal dataOutClk_s : std_logic;
|
signal dataOutClk_s : std_logic;
|
|
|
signal ioSymRdEn_n_s : std_logic;
|
|
|
|
signal wurPattern_s : std_Logic_vector(31 downto 0);
|
|
signal wurMsk_s : std_Logic_vector(31 downto 0);
|
|
signal codeA_s : std_logic;
|
|
signal codeB_s : std_logic;
|
|
|
|
signal wurCodeEn_n_s : std_logic;
|
|
signal wurCodeFin_s : std_logic;
|
|
|
|
signal rst_n_s : std_logic := '1';
|
signal rst_n_s : std_logic := '1';
|
|
|
begin
|
begin
|
|
|
sysArch_i : sysArch
|
sysArch_i : sysArch
|
Line 214... |
Line 201... |
stalled_n => stalled_n_s,
|
stalled_n => stalled_n_s,
|
|
|
rst_n => rst_n_s
|
rst_n => rst_n_s
|
);
|
);
|
|
|
symDecoder_i: symDecoder
|
|
port map (
|
|
clk => clk_s,
|
|
|
|
codeA => codeA_s,
|
|
codeB => codeB_s,
|
|
|
|
ioAddr => ioAddr_s(3 downto 0),
|
|
ioWriteEn_n => ioWrEn_n_s,
|
|
ioReadEn_n => ioSymRdEn_n_s,
|
|
|
|
ioDataOut => ioDataIn_s,
|
|
ioDataIn => ioDataOut_s,
|
|
|
|
irq => irqLine_s,
|
|
irq_ack => irqLineAck_s,
|
|
|
|
rst_n => rst_n_s
|
|
);
|
|
|
|
ioSymRdEn_n_s <= ioRdEn_n_s when ioAddr_s(7 downto 4) = "0100" else
|
|
'1';
|
|
|
|
tb_wurCodeGen_i: wurCodeGen_tb
|
|
port map (
|
|
clk => clk_s,
|
|
pattern => wurPattern_s,
|
|
mask => wurMsk_s,
|
|
codeA => codeA_s,
|
|
codeB => codeB_s,
|
|
finished => wurCodeFin_s,
|
|
rst_n => wurCodeEn_n_s
|
|
);
|
|
|
|
tb_clock32kHz_i: lib_tb_clock32kHz
|
tb_clock32kHz_i: lib_tb_clock32kHz
|
port map (
|
port map (
|
clk => clk_s,
|
clk => clk_s,
|
rst_n => rst_n_s
|
rst_n => rst_n_s
|
);
|
);
|
|
|
tb_rom32bit_i: lib_tb_rom32bit
|
tb_rom32bit_i: lib_tb_rom32bit
|
generic map ( fileName => "../programs/sha1Test.ihex" )
|
generic map ( fileName => "../opencores/tinyvliw8/tinyvliw8/trunk/programs/timerIrq.ihex" )
|
port map (
|
port map (
|
addr => instAddr_s,
|
addr => instAddr_s,
|
dataOut => instData_s,
|
dataOut => instData_s,
|
en_n => instEn_n_s
|
en_n => instEn_n_s
|
);
|
);
|
Line 286... |
Line 239... |
dataInClk_s <= '1' when (dataEn_n_s = '0' and dataEnDly_n_s = '1' and dataWr_n_s = '1') or
|
dataInClk_s <= '1' when (dataEn_n_s = '0' and dataEnDly_n_s = '1' and dataWr_n_s = '1') or
|
(dataEn_n_s = '0' and dataEnDly_n_s = '0' and dataWr_n_s = '0') else
|
(dataEn_n_s = '0' and dataEnDly_n_s = '0' and dataWr_n_s = '0') else
|
'0';
|
'0';
|
dataOutClk_s <= not(dataInClk_s);
|
dataOutClk_s <= not(dataInClk_s);
|
|
|
|
|
wurGen_p : process
|
|
begin
|
|
wurMsk_s <= x"ffffffff";
|
|
wurPattern_s <= x"abababab";
|
|
wurCodeEn_n_s <= '0';
|
|
|
|
loop
|
|
wait on rst_n_s;
|
|
exit when rst_n_s = '1';
|
|
end loop;
|
|
|
|
loop
|
|
wait for 100 ms;
|
|
|
|
wurCodeEn_n_s <= '1';
|
|
|
|
loop
|
|
wait on wurCodeFin_s;
|
|
exit when wurCodeFin_s = '1';
|
|
end loop;
|
|
|
|
wurCodeEn_n_s <= '0';
|
|
end loop;
|
|
end process;
|
|
|
|
end beh;
|
end beh;
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|