-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessor_tb.vhd
160 lines (143 loc) · 4.52 KB
/
processor_tb.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---------------------------------------------------------------------------------------------------
--
-- Title : Test Bench for procesador
-- Design : practica_1
-- Author : alumnoeps
-- Company : eps
--
---------------------------------------------------------------------------------------------------
--
-- File : $DSN\src\TestBench\procesador_TB.vhd
-- Generated : 15/03/2006, 15:43
-- From : $DSN\src\procesador.vhd
-- By : Active-HDL Built-in Test Bench Generator ver. 1.2s
--
---------------------------------------------------------------------------------------------------
--
-- Description : Automatically generated Test Bench for procesador_tb
--
---------------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Add your library and packages declaration here ...
entity processor_tb is
end processor_tb;
architecture processor_tb_arq of processor_tb is
-- Component declaration of the tested unit
component processor
port(
Clk : in std_logic;
Reset : in std_logic;
-- Instruction memory
I_Addr : out std_logic_vector(31 downto 0);
I_RdStb : out std_logic;
I_WrStb : out std_logic;
I_DataOut : out std_logic_vector(31 downto 0);
I_DataIn : in std_logic_vector(31 downto 0);
-- Data memory
D_Addr : out std_logic_vector(31 downto 0);
D_RdStb : out std_logic;
D_WrStb : out std_logic;
D_DataOut : out std_logic_vector(31 downto 0);
D_DataIn : in std_logic_vector(31 downto 0)
);
end component;
component Memory
generic (
C_ELF_FILENAME : string;
C_MEM_SIZE : integer
);
port (
Clk : in std_logic;
Addr : in std_logic_vector(31 downto 0);
RdStb : in std_logic;
WrStb : in std_logic;
DataIn : in std_logic_vector(31 downto 0);
DataOut : out std_logic_vector(31 downto 0)
);
end component;
signal Clk : std_logic;
signal Reset : std_logic;
-- Instruction memory
signal I_Addr : std_logic_vector(31 downto 0);
signal I_RdStb : std_logic;
signal I_WrStb : std_logic;
signal I_DataOut : std_logic_vector(31 downto 0);
signal I_DataIn : std_logic_vector(31 downto 0);
-- Data memory
signal D_Addr : std_logic_vector(31 downto 0);
signal D_RdStb : std_logic;
signal D_WrStb : std_logic;
signal D_DataOut : std_logic_vector(31 downto 0);
signal D_DataIn : std_logic_vector(31 downto 0);
constant tper_clk : time := 50 ns;
constant tdelay : time := 120 ns; -- antes 150, sino no enta direccion 0
begin
-- Unit Under Test port map
UUT : processor
port map (
Clk => Clk,
Reset => Reset,
-- Instruction memory
I_Addr => I_Addr,
I_RdStb => I_RdStb,
I_WrStb => I_WrStb,
I_DataOut => I_DataOut,
I_DataIn => I_DataIn,
-- Data memory
D_Addr => D_Addr,
D_RdStb => D_RdStb,
D_WrStb => D_WrStb,
D_DataOut => D_DataOut,
D_DataIn => D_DataIn
);
Instruction_Mem_inst : memory
generic map (
C_ELF_FILENAME => "programa",
C_MEM_SIZE => 1024
)
port map (
Clk => Clk,
Addr => I_Addr,
RdStb => I_RdStb,
WrStb => I_WrStb,
DataIn => I_DataOut,
DataOut => I_DataIn
);
Data_Mem_inst : memory
generic map (
C_ELF_FILENAME => "data",
C_MEM_SIZE => 1024
)
port map(
Clk => Clk,
Addr => D_Addr,
RdStb => D_RdStb,
WrStb => D_WrStb,
DataIn => D_DataOut,
DataOut => D_DataIn
);
process
begin
Clk <= '0';
wait for tper_clk/2;
Clk <= '1';
wait for tper_clk/2;
end process;
process
begin
Reset <= '1';
wait for tdelay;
Reset <= '0';
wait;
end process;
end processor_tb_arq;
--configuration testbench_for_procesador of processor_tb is
-- for processor_tb_arq
-- for UUT : processor
-- use entity work.processor(processor);
-- end for;
-- end for;
--end testbench_for_procesador;