-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtop.vhd
233 lines (181 loc) · 6.66 KB
/
top.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library lattice;
use lattice.all;
entity top is
port (
N64_ALEH_I : in std_logic;
N64_ALEL_I : in std_logic;
N64_READn_I : in std_logic;
N64_WRITEn_I : in std_logic;
N64_AD_IO : inout std_logic_vector(15 downto 0);
N64_SI_CLK_I : in std_logic;
N64_CIC_DCLK_I : in std_logic;
N64_CIC_D_IO : inout std_logic;
N64_S_DAT_IO : inout std_logic;
N64_COLD_RESET_I : in std_logic;
N64_NMI_I : in std_logic;
-- QSPI
BOOT_CSN_O : out std_logic;
BOOT_SCK_O : out std_logic;
BOOT_DQ_IO : inout std_logic_vector (3 downto 0);
ROM_CSN_O : out std_logic_vector(1 downto 0);
ROM_SCK_O : out std_logic;
ROM_DQ_IO : inout std_logic_vector (3 downto 0);
-- SRAM
RAM_ADDR_O : out std_logic_vector(16 downto 0);
RAM_DATA_IO : inout std_logic_vector(15 downto 0);
RAM_CE_O : out std_logic;
RAM_NWE_O : out std_logic;
RAM_NOE_O : out std_logic;
-- USB-UART
USB_DETECT_I : in std_logic;
UART_RTS_I : in std_logic;
UART_RX_I : in std_logic;
UART_TX_O : out std_logic;
-- RTC (I2C)
RTC_SDA_IO : inout std_logic;
RTC_SCL_IO : inout std_logic;
-- Jumper
JP1_I : in std_logic;
-- Testpoints
-- TP1_O : out std_logic;
TP2_O : out std_logic;
TP3_O : out std_logic;
TP4_O : out std_logic;
-- LEDs
LED_O : out std_logic_vector(3 downto 0)
);
end entity top;
architecture Behavioral of top is
COMPONENT OSCH
-- synthesis translate_off
GENERIC (NOM_FREQ: string := "2.56");
-- synthesis translate_on
PORT (STDBY : IN std_logic;
OSC : OUT std_logic;
SEDSTDBY: OUT std_logic);
END COMPONENT;
attribute NOM_FREQ : string;
attribute NOM_FREQ of OSCinst0 : label is "133.0";
component pll0
port (CLKI: in std_logic; CLKOP: out std_logic;
CLKOS: out std_logic; LOCK: out std_logic);
end component;
component brutzelkarte
port (
CLK_I : in std_logic;
RST_I : in std_logic;
N64_ALEH_I : in std_logic;
N64_ALEL_I : in std_logic;
N64_READn_I : in std_logic;
N64_WRITEn_I : in std_logic;
N64_AD_IO : inout std_logic_vector(15 downto 0);
CIC_FAST_CLOCK_I : in std_logic;
CIC_REGION_I : in std_logic;
N64_CIC_DCLK_I : in std_logic;
N64_CIC_D_IO : inout std_logic;
N64_SI_CLK_I : in std_logic;
N64_S_DAT_IO : inout std_logic;
N64_COLD_RESET_I : in std_logic;
N64_NMI_I : in std_logic;
-- QSPI
BOOT_CSN_O : out std_logic;
BOOT_SCK_O : out std_logic;
BOOT_DQ_IO : inout std_logic_vector (3 downto 0);
ROM_CSN_O : out std_logic_vector(1 downto 0);
ROM_SCK_O : out std_logic;
ROM_DQ_IO : inout std_logic_vector (3 downto 0);
-- SRAM
RAM_ADDR_O : out std_logic_vector(16 downto 0);
RAM_DATA_IO : inout std_logic_vector(15 downto 0);
RAM_CE_O : out std_logic;
RAM_NWE_O : out std_logic;
RAM_NOE_O : out std_logic;
-- USB-UART
USB_DETECT_I : in std_logic;
UART_RTS_I : in std_logic;
UART_RX_I : in std_logic;
UART_TX_O : out std_logic;
-- RTC (I2C)
RTC_SDA_IO : inout std_logic;
RTC_SCL_IO : inout std_logic;
-- Testpoints
TP1_O : out std_logic;
TP2_O : out std_logic;
TP3_O : out std_logic;
TP4_O : out std_logic;
-- LEDs
LED_O : out std_logic_vector(3 downto 0)
);
end component;
signal clk_int : std_logic;
signal clk : std_logic;
signal clk_cic : std_logic;
signal pll_locked : std_logic;
signal reset : std_logic;
begin
OSCInst0: OSCH
-- synthesis translate_off
GENERIC MAP (NOM_FREQ => "133.0")
-- synthesis translate_on
PORT MAP (STDBY => '0',
OSC => clk_int,
SEDSTDBY => open
);
pll0_inst : pll0
port map (
CLKI => clk_int,
CLKOP => clk,
CLKOS => clk_cic,
LOCK => pll_locked
);
reset <= not pll_locked;
brutzelkarte_inst : brutzelkarte
port map (
CLK_I => clk,
RST_I => reset,
N64_ALEH_I => N64_ALEH_I,
N64_ALEL_I => N64_ALEL_I,
N64_READn_I => N64_READn_I,
N64_WRITEn_I => N64_WRITEn_I,
N64_AD_IO => N64_AD_IO,
CIC_FAST_CLOCK_I => clk_cic,
CIC_REGION_I => JP1_I,
N64_CIC_DCLK_I => N64_CIC_DCLK_I,
N64_CIC_D_IO => N64_CIC_D_IO,
N64_SI_CLK_I => N64_SI_CLK_I,
N64_S_DAT_IO => N64_S_DAT_IO,
N64_COLD_RESET_I => N64_COLD_RESET_I,
N64_NMI_I => N64_NMI_I,
-- QSPI
BOOT_CSN_O => BOOT_CSN_O,
BOOT_SCK_O => BOOT_SCK_O,
BOOT_DQ_IO => BOOT_DQ_IO,
ROM_CSN_O => ROM_CSN_O,
ROM_SCK_O => ROM_SCK_O,
ROM_DQ_IO => ROM_DQ_IO,
-- SRAM
RAM_ADDR_O => RAM_ADDR_O,
RAM_DATA_IO => RAM_DATA_IO,
RAM_CE_O => RAM_CE_O,
RAM_NWE_O => RAM_NWE_O,
RAM_NOE_O => RAM_NOE_O,
-- USB-UART
USB_DETECT_I => USB_DETECT_I,
UART_RTS_I => UART_RTS_I,
UART_RX_I => UART_RX_I,
UART_TX_O => UART_TX_O,
-- RTC (I2C)
RTC_SDA_IO => RTC_SDA_IO,
RTC_SCL_IO => RTC_SCL_IO,
-- Testpoints
TP1_O => open,
TP2_O => TP2_O,
TP3_O => TP3_O,
TP4_O => TP4_O,
-- LEDs
LED_O => LED_O
);
end architecture Behavioral;