OpenCores
URL https://opencores.org/ocsvn/iota_pow_vhdl/iota_pow_vhdl/trunk

Subversion Repositories iota_pow_vhdl

[/] [iota_pow_vhdl/] [trunk/] [vhdl_altera_de1/] [de1.vhd] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 microengin
-- IOTA Pearl Diver VHDL Port
2
--
3
-- Written 2018 by Thomas Pototschnig <microengineer18@gmail.com>
4
--
5
-- This source code is currently licensed under
6
-- Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7
-- 
8
-- http://www.microengineer.eu
9
-- 
10
-- If you like my project please consider a donation to
11
--
12
-- LLEYMHRKXWSPMGCMZFPKKTHSEMYJTNAZXSAYZGQUEXLXEEWPXUNWBFDWESOJVLHQHXOPQEYXGIRBYTLRWHMJAOSHUY
13
--
14
-- As soon as donations reach 1000MIOTA, everything will become
15
-- GPL and open for any use - commercial included.
16
 
17
library IEEE;
18
use IEEE.STD_LOGIC_1164.ALL;
19
use IEEE.STD_LOGIC_ARITH.ALL;
20
use IEEE.STD_LOGIC_UNSIGNED.ALL;
21
 
22
entity de1 is
23
        port (
24
--              ////////////////////    Clock Input             ////////////////////     
25
                CLOCK_24 : in std_logic_vector (1 downto 0);
26
                CLOCK_27 : in std_logic_vector (1 downto 0);
27
                CLOCK_50 : in std_logic;
28
                EXT_CLOCK : in std_logic;
29
--              ////////////////////    Push Button             ////////////////////
30
                KEY : in std_logic_vector(3 downto 0);
31
--              ////////////////////    DPDT Switch             ////////////////////
32
                SW : in std_logic_vector (9 downto 0);
33
--              ////////////////////    7-SEG Dispaly   ////////////////////
34
                HEX0 : out std_logic_vector (6 downto 0);
35
                HEX1 : out std_logic_vector (6 downto 0);
36
                HEX2 : out std_logic_vector (6 downto 0);
37
                HEX3 : out std_logic_vector (6 downto 0);
38
--              ////////////////////////        LED             ////////////////////////
39
                LEDG : out std_logic_vector (7 downto 0);
40
                LEDR : out std_logic_vector (9 downto 0);
41
--              ////////////////////////        UART    ////////////////////////
42
                UART_TXD : out std_logic;
43
                UART_RXD : in std_logic;
44
--              /////////////////////   SDRAM Interface         ////////////////
45
                DRAM_DQ : inout std_logic_vector (15 downto 0);
46
                DRAM_ADDR : out std_logic_vector (11 downto 0);
47
                DRAM_LDQM : out std_logic;
48
                DRAM_UDQM : out std_logic;
49
                DRAM_WE_N : out std_logic;
50
                DRAM_CAS_N : out std_logic;
51
                DRAM_RAS_N : out std_logic;
52
                DRAM_CS_N : out std_logic;
53
                DRAM_BA_0 : out std_logic;
54
                DRAM_BA_1 : out std_logic;
55
                DRAM_CLK : out std_logic;
56
                DRAM_CKE : out std_logic;
57
--              ////////////////////    Flash Interface         ////////////////
58
                FL_DQ : inout std_logic_vector (7 downto 0);
59
                FL_ADDR : out std_logic_vector (21 downto 0);
60
                FL_WE_N : out std_logic;
61
                FL_RST_N : out std_logic;
62
                FL_OE_N : out std_logic;
63
                FL_CE_N : out std_logic;
64
--              ////////////////////    SRAM Interface          ////////////////
65
                SRAM_DQ : inout std_logic_vector (15 downto 0);
66
                SRAM_ADDR : out std_logic_vector (17 downto 0);
67
                SRAM_UB_N : out std_logic;
68
                SRAM_LB_N : out std_logic;
69
                SRAM_WE_N : out std_logic;
70
                SRAM_CE_N : out std_logic;
71
                SRAM_OE_N : out std_logic;
72
--              ////////////////////    SD_Card Interface       ////////////////
73
                SD_DAT : inout std_logic;
74
                SD_DAT3 : inout std_logic;
75
                SD_CMD : inout std_logic;
76
                SD_CLK : out std_logic;
77
--              ////////////////////    USB JTAG link   ////////////////////
78
                TDI : in std_logic;
79
                TCK : in std_logic;
80
                TCS : in std_logic;
81
            TDO : out std_logic;
82
--              ////////////////////    I2C             ////////////////////////////
83
                I2C_SDAT : inout std_logic;
84
                I2C_SCLK : out std_logic;
85
--              ////////////////////    PS2             ////////////////////////////
86
                PS2_DAT : in std_logic;
87
                PS2_CLK : in std_logic;
88
--              ////////////////////    VGA             ////////////////////////////
89
                VGA_HS : out std_logic;
90
                VGA_VS : out std_logic;
91
                VGA_R  : out std_logic_vector (3 downto 0);
92
                VGA_G: out std_logic_vector (3 downto 0);
93
                VGA_B: out std_logic_vector (3 downto 0);
94
--              ////////////////        Audio CODEC             ////////////////////////
95
                AUD_ADCLRCK : inout std_logic;
96
                AUD_ADCDAT : in std_logic;
97
                AUD_DACLRCK : inout std_logic;
98
                AUD_DACDAT : out std_logic;
99
                AUD_BCLK : out std_logic;
100
                AUD_XCK : out std_logic;
101
--              ////////////////////    GPIO    ////////////////////////////
102
                GPIO_0 : inout std_logic_vector (35 downto 0);
103
                GPIO_1 : inout std_logic_vector (35 downto 0)
104
        );
105
end;
106
 
107
architecture beh of de1 is
108
 
109
 
110
signal reset : std_logic;
111
 
112
signal pll_clk : std_logic;
113
signal pll_reset : std_logic := '0';
114
signal pll_locked : std_logic;
115
 
116
signal spi_data_tx : std_logic_vector(31 downto 0);
117
signal spi_data_rx  : std_logic_vector(31 downto 0);
118
signal spi_data_rx_en : std_logic;
119
 
120
signal running : std_logic := '0';
121
signal overflow : std_logic := '0';
122
signal found : std_logic := '0';
123
 
124
signal spi_mosi : std_logic;
125
signal spi_miso : std_logic;
126
signal spi_sck : std_logic;
127
signal spi_ss : std_logic;
128 4 microengin
signal pll_slow : std_logic;
129 2 microengin
component spi_slave
130
        port
131
        (
132
                clk : in std_logic;
133
                reset : in std_logic;
134
 
135
                mosi : in std_logic;
136
                miso : out std_logic;
137
                sck : in std_logic;
138
                ss : in std_logic;
139
 
140
 
141
                data_rd : in std_logic_vector(31 downto 0);
142
                data_wr : out std_logic_vector(31 downto 0);
143
                data_wren : out std_logic
144
        );
145
end component;
146
 
147
component pll
148
        PORT
149
        (
150
                areset          : IN STD_LOGIC  := '0';
151
                inclk0          : IN STD_LOGIC  := '0';
152
                c0              : OUT STD_LOGIC ;
153 4 microengin
                c1 : out std_logic;
154 2 microengin
                locked          : OUT STD_LOGIC
155
        );
156
end component;
157
 
158
component curl
159
        port
160
        (
161
                clk : in std_logic;
162 4 microengin
                clk_slow : in std_logic;
163 2 microengin
                reset : in std_logic;
164
 
165
                spi_data_rx : in std_logic_vector(31 downto 0);
166
                spi_data_tx : out std_logic_vector(31 downto 0);
167
                spi_data_rxen : in std_logic;
168
 
169
                overflow : out std_logic;
170
                running : out std_logic;
171
                found : out std_logic
172
        );
173
end component;
174
 
175
begin
176
        pll0 : pll port map (
177
                areset => pll_reset,
178
                inclk0 => CLOCK_50,
179
                c0 => pll_clk,
180 4 microengin
                c1      => pll_slow,
181 2 microengin
                locked => pll_locked
182
        );
183
 
184 4 microengin
 
185 2 microengin
        spi0 : spi_slave port map (
186 4 microengin
                clk => pll_slow,
187 2 microengin
                reset => reset,
188
 
189
                mosi => spi_mosi,
190
                miso => spi_miso,
191
                sck => spi_sck,
192
                ss => spi_ss,
193
 
194
                data_rd => spi_data_tx,
195
                data_wr => spi_data_rx,
196
                data_wren => spi_data_rx_en
197
        );
198
 
199
        curl0 : curl port map (
200
                clk => pll_clk,
201
                reset => reset,
202 4 microengin
                clk_slow => pll_slow,
203 2 microengin
 
204
                spi_data_rx => spi_data_rx,
205
                spi_data_tx => spi_data_tx,
206
                spi_data_rxen => spi_data_rx_en,
207
 
208
                overflow => overflow,
209
                running => running,
210
                found => found
211
        );
212
 
213
 
214
-- disable all DE1 stuff        
215
DRAM_DQ <= (others => 'Z');
216
FL_DQ <= (others => 'Z');
217
SRAM_DQ <= (others => 'Z');
218
SD_DAT <= 'Z';
219
I2C_SDAT <= 'Z';
220
GPIO_0 <= (others => 'Z');
221
GPIO_1 <= (others => 'Z');
222
 
223
LEDR <= "0" & "1" & spi_ss & spi_sck & spi_mosi & spi_miso & reset & overflow & found & running;
224
LEDG <= (others => '0');
225
 
226
AUD_BCLK <= '0';
227
AUD_DACLRCK <= '0';
228
AUD_ADCLRCK     <= '0';
229
AUD_XCK <= '0';
230
 
231
SRAM_ADDR(17)<='0';
232
 
233
reset <= not SW(0);
234
 
235
spi_mosi <= GPIO_0(0);
236
spi_sck <= GPIO_0(2);
237
spi_ss <= GPIO_0(3);
238
 
239
-- all pins except one is input
240
GPIO_0(3 downto 0) <= "ZZ" & spi_miso & "Z";
241
 
242
 
243
end architecture;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.