-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathECU.vhd
113 lines (93 loc) · 3.42 KB
/
ECU.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
------------------------------------------------------
-- Assignment SSDS, Andrea Floridia S224906
-- ECU
------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
------------------------------------------------------
------------------------------------------------------
entity ECU is
port (
clock: in std_logic;
power_on : in std_logic;
data_golden : in std_logic_vector(31 downto 0);
data_out_ram : in std_logic_vector(31 downto 0);
result : in std_logic_vector(31 downto 0);
enable_golden : out std_logic;
enable_stimuli : out std_logic;
enable_ram : out std_logic;
wor : out std_logic_vector(0 downto 0);
ok_status : out std_logic;
fault_status : out std_logic;
debug_port : out std_logic_vector(31 downto 0);
address_ram : out std_logic_vector(15 downto 0);
address_rom : out std_logic_vector(15 downto 0);
data_in_ram : out std_logic_vector(31 downto 0)
);
end ECU;
------------------------------------------------------
------------------------------------------------------
architecture Behavioral of ECU is
------------------------------------------------------
-- Counter
------------------------------------------------------
component down_counter is
port (
I: in std_logic_vector(15 downto 0);
tc: out std_logic;
clk, clr, cnt: in std_logic
);
end component;
------------------------------------------------------
-- Control Unit
------------------------------------------------------
component CU is
port (
clock: in std_logic;
power_on : in std_logic;
data_golden : in std_logic_vector(31 downto 0);
command : out std_logic_vector(1 downto 0);
result : in std_logic_vector(31 downto 0);
enable_golden : out std_logic;
enable_stimuli : out std_logic;
enable_ram : out std_logic;
wor : out std_logic_vector(0 downto 0);
ok_status : out std_logic;
fault_status : out std_logic;
debug_data : out std_logic_vector(15 downto 0);
address_ram : out std_logic_vector(15 downto 0);
address_rom : out std_logic_vector(15 downto 0);
data_in_ram : out std_logic_vector(31 downto 0);
clear_counter : out std_logic;
count : out std_logic;
tc : in std_logic;
in_counter : out std_logic_vector(15 downto 0)
);
end component;
------------------------------------------------------
-- Debug Interface
------------------------------------------------------
component debug_interface is
port (
command : in std_logic_vector(1 downto 0);
number_of_errors : in std_logic_vector(15 downto 0);
data_out_ram : in std_logic_vector(31 downto 0);
debug_port : out std_logic_vector(31 downto 0)
);
end component;
------------------------------------------------------
-- Internal Signals
------------------------------------------------------
signal clear_counter, count, tc : std_logic;
signal in_counter : std_logic_vector(15 downto 0);
signal debug_data : std_logic_vector(15 downto 0);
signal command : std_logic_vector(1 downto 0);
begin
CU_0: CU port map ( clock, power_on, data_golden, command, result, enable_golden, enable_stimuli,
enable_ram, wor, ok_status, fault_status, debug_data, address_ram, address_rom,
data_in_ram, clear_counter, count, tc, in_counter);
CNT0: down_counter port map(in_counter, tc, clock, clear_counter, count);
DB_0: debug_interface port map(command, debug_data, data_out_ram, debug_port);
end Behavioral;