-
Notifications
You must be signed in to change notification settings - Fork 0
/
toplevel_synth.sv
244 lines (203 loc) · 7.71 KB
/
toplevel_synth.sv
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
234
235
236
237
238
239
240
241
242
243
244
//
// Modified by Emily Boarer, 2024
// Copyright (c) 2015 A. Theodore Markettos
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
// Top level file for DE1-SoC board with
// Cambridge display board
// Uncomment this if you have an HPS (ARM CPU) in your design
//`define ENABLE_HPS
// diss includes:
`include "../verilog/mkToplevel.v"
`include "../lib/VerilogBlockRAM_OneCycle.v"
`include "../lib/VerilogBlockRAM_TrueDualPort_OneCycle.v"
module toplevel_synth(
// Analogue-digital converter
inout ADC_CS_N,
output ADC_DIN,
input ADC_DOUT,
output ADC_SCLK,
// Audio DAC
input AUD_ADCDAT,
inout AUD_ADCLRCK,
inout AUD_BCLK,
output AUD_DACDAT,
inout AUD_DACLRCK,
output AUD_XCK,
// Clocks
input CLOCK_50,
input CLOCK2_50,
input CLOCK3_50,
input CLOCK4_50,
// FPGA-side SDRAM
output [12:0] DRAM_ADDR,
output [1:0] DRAM_BA,
output DRAM_CAS_N,
output DRAM_CKE,
output DRAM_CLK,
output DRAM_CS_N,
inout [15:0] DRAM_DQ,
output DRAM_LDQM,
output DRAM_RAS_N,
output DRAM_UDQM,
output DRAM_WE_N,
// Fan control (unused on native board)
output FAN_CTRL,
// FPGA I2C
output FPGA_I2C_SCLK,
inout FPGA_I2C_SDAT,
// General purpose I/O
inout [35:0] GPIO_0,
// Hex LEDs
output [6:0] HEX0,
output [6:0] HEX1,
output [6:0] HEX2,
output [6:0] HEX3,
output [6:0] HEX4,
output [6:0] HEX5,
`ifdef ENABLE_HPS
// ARM Cortex A9 Hard Processor System
inout HPS_CONV_USB_N,
output [14:0] HPS_DDR3_ADDR,
output [2:0] HPS_DDR3_BA,
output HPS_DDR3_CAS_N,
output HPS_DDR3_CKE,
output HPS_DDR3_CK_N,
output HPS_DDR3_CK_P,
output HPS_DDR3_CS_N,
output [3:0] HPS_DDR3_DM,
inout [31:0] HPS_DDR3_DQ,
inout [3:0] HPS_DDR3_DQS_N,
inout [3:0] HPS_DDR3_DQS_P,
output HPS_DDR3_ODT,
output HPS_DDR3_RAS_N,
output HPS_DDR3_RESET_N,
input HPS_DDR3_RZQ,
output HPS_DDR3_WE_N,
output HPS_ENET_GTX_CLK,
inout HPS_ENET_INT_N,
output HPS_ENET_MDC,
inout HPS_ENET_MDIO,
input HPS_ENET_RX_CLK,
input [3:0] HPS_ENET_RX_DATA,
input HPS_ENET_RX_DV,
output [3:0] HPS_ENET_TX_DATA,
output HPS_ENET_TX_EN,
inout [3:0] HPS_FLASH_DATA,
output HPS_FLASH_DCLK,
output HPS_FLASH_NCSO,
inout HPS_GSENSOR_INT,
inout HPS_I2C1_SCLK,
inout HPS_I2C1_SDAT,
inout HPS_I2C2_SCLK,
inout HPS_I2C2_SDAT,
inout HPS_I2C_CONTROL,
inout HPS_KEY,
inout HPS_LED,
inout HPS_LTC_GPIO,
output HPS_SD_CLK,
inout HPS_SD_CMD,
inout [3:0] HPS_SD_DATA,
output HPS_SPIM_CLK,
input HPS_SPIM_MISO,
output HPS_SPIM_MOSI,
inout HPS_SPIM_SS,
input HPS_UART_RX,
output HPS_UART_TX,
input HPS_USB_CLKOUT,
inout [7:0] HPS_USB_DATA,
input HPS_USB_DIR,
input HPS_USB_NXT,
output HPS_USB_STP,
`endif /*ENABLE_HPS*/
// Infra-red
input IRDA_RXD,
output IRDA_TXD,
// Push buttons on DE1-SoC mainboard
input [3:0] KEY,
// Red LED row
output [9:0] LEDR,
// PS2 port
inout PS2_CLK,
inout PS2_CLK2,
inout PS2_DAT,
inout PS2_DAT2,
// Slide switches
input [9:0] SW,
// TMDS
input TD_CLK27,
input [7:0] TD_DATA,
input TD_HS,
output TD_RESET_N,
input TD_VS,
// VGA video
output [7:0] VGA_B,
output VGA_BLANK_N,
output VGA_CLK,
output [7:0] VGA_G,
output VGA_HS,
output [7:0] VGA_R,
output VGA_SYNC_N,
output VGA_VS,
// Cambridge display board (plugged into GPIO1 port)
// rotary dials
input [1:0] DIALL,
input [1:0] DIALR,
// LED pixel ring (inverted before reaching ring)
output LEDRINGn,
// LCD display
output [7:0] LCD_R_out,
output [7:0] LCD_G_out,
output [7:0] LCD_B_out,
// -- only LCD_R[7:2], LCD_G[7:2], LCD_B[7:2] are wired
// through to display board, low-order pins are ignored
// outputs need to be inverted based on VERSION pin
output LCD_HSYNC,
output LCD_VSYNC,
output LCD_DEN,
output LCD_DCLK,
output LCD_ON, // set high to enable LCD panel
output LCD_BACKLIGHT, // set high to turn on backlight, PWM to dim
// shift register for buttons on display board
output SHIFT_CLKIN,
output SHIFT_LOAD,
input SHIFT_OUT,
// capacitive touch sensor reset (high=enabled)
output TOUCH_WAKE,
// I2C for touch, temperature and EEPROM
inout DISPLAY_SDA,
inout DISPLAY_SCL,
// externally pulled low on 2019 (green) boards
// weak pullup inside FPGA
input VERSION
);
// logic [27:0] count;
// always_ff @(posedge CLOCK_50) begin
// count <= count + 1;
// end
// always_comb begin
// LEDR <= count[27:18];
// end
// diss bits:
mkToplevel toplevel(CLOCK_50, !KEY[0], HEX0[0]);
endmodule