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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [impl/] [avnet_sp3a_eval_uart_vhd.vhd] - Blame information for rev 24

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

Line No. Rev Author Line
1 24 ste.fis
--------------------------------------------------------------------------------
2
-- This sourcecode is released under BSD license.
3
-- Please see http://www.opensource.org/licenses/bsd-license.php for details!
4
--------------------------------------------------------------------------------
5
--
6
-- Copyright (c) 2011, Stefan Fischer <Ste.Fis@OpenCores.org>
7
-- All rights reserved.
8
--
9
-- Redistribution and use in source and binary forms, with or without 
10
-- modification, are permitted provided that the following conditions are met:
11
--
12
--  * Redistributions of source code must retain the above copyright notice, 
13
--    this list of conditions and the following disclaimer.
14
--  * Redistributions in binary form must reproduce the above copyright notice,
15
--    this list of conditions and the following disclaimer in the documentation
16
--    and/or other materials provided with the distribution. 
17
--  * Neither the name of the author nor the names of his contributors may be 
18
--    used to endorse or promote products derived from this software without 
19
--    specific prior written permission.
20
--
21
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
22
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
23
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
24
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
25
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
26
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
27
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
28
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
29
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
30
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
31
-- POSSIBILITY OF SUCH DAMAGE.
32
--
33
--------------------------------------------------------------------------------
34
-- filename: avnet_sp3a_eval_uart_vhd.vhd
35
-- description: synthesizable PicoBlaze (TM) uart example using wishbone / 
36
--              AVNET (R) Sp3A-Eval-Kit version
37
-- todo4user: add other modules as needed
38
-- version: 0.0.0
39
-- changelog: - 0.0.0, initial release
40
--            - ...
41
--------------------------------------------------------------------------------
42
 
43
 
44
library ieee;
45
use ieee.std_logic_1164.all;
46
use ieee.numeric_std.all;
47
 
48
library unisim;
49
use unisim.vcomponents.all;
50
 
51
 
52
entity avnet_sp3a_eval_uart_vhd is
53
  port
54
  (
55
    FPGA_RESET : in std_logic;
56
    CLK_16MHZ : in std_logic;
57
 
58
    UART_TXD : in std_logic;
59
    UART_RXD : out std_logic;
60
 
61
    LED1 : out std_logic
62
  );
63
end avnet_sp3a_eval_uart_vhd;
64
 
65
 
66
architecture rtl of avnet_sp3a_eval_uart_vhd is
67
 
68
  component kcpsm3 is
69
    port
70
    (
71
      address : out std_logic_vector(9 downto 0);
72
      instruction : in std_logic_vector(17 downto 0);
73
      port_id : out std_logic_vector(7 downto 0);
74
      write_strobe : out std_logic;
75
      out_port : out std_logic_vector(7 downto 0);
76
      read_strobe : out std_logic;
77
      in_port : in std_logic_vector(7 downto 0);
78
      interrupt : in std_logic;
79
      interrupt_ack : out std_logic;
80
      reset : in std_logic;
81
      clk : in std_logic
82
    );
83
  end component;
84
 
85
  component pbwbuart is
86
    port
87
    (
88
      address : in std_logic_vector(9 downto 0);
89
      instruction : out std_logic_vector(17 downto 0);
90
      clk : in std_logic
91
    );
92
  end component;
93
 
94
  component wbm_picoblaze is
95
    port
96
    (
97
      rst : in std_logic;
98
      clk : in std_logic;
99
 
100
      wbm_cyc_o : out std_logic;
101
      wbm_stb_o : out std_logic;
102
      wbm_we_o : out std_logic;
103
      wbm_adr_o : out std_logic_vector(7 downto 0);
104
      wbm_dat_m2s_o : out std_logic_vector(7 downto 0);
105
      wbm_dat_s2m_i : in std_logic_vector(7 downto 0);
106
      wbm_ack_i : in std_logic;
107
 
108
      pb_port_id_i : in std_logic_vector(7 downto 0);
109
      pb_write_strobe_i : in std_logic;
110
      pb_out_port_i : in std_logic_vector(7 downto 0);
111
      pb_read_strobe_i : in std_logic;
112
      pb_in_port_o : out std_logic_vector(7 downto 0)
113
    );
114
  end component;
115
 
116
  component wbs_uart is
117
    port
118
    (
119
      rst : in std_logic;
120
      clk : in std_logic;
121
 
122
      wbs_cyc_i : in std_logic;
123
      wbs_stb_i : in std_logic;
124
      wbs_we_i : in std_logic;
125
      wbs_adr_i : in std_logic_vector(7 downto 0);
126
      wbs_dat_m2s_i : in std_logic_vector(7 downto 0);
127
      wbs_dat_s2m_o : out std_logic_vector(7 downto 0);
128
      wbs_ack_o : out std_logic;
129
 
130
      uart_rx_si_i : in std_logic;
131
      uart_tx_so_o : out std_logic
132
    );
133
  end component;
134
 
135
  signal rst : std_logic := '1';
136
  signal clk : std_logic := '1';
137
 
138
  signal wb_cyc : std_logic := '0';
139
  signal wb_stb : std_logic := '0';
140
  signal wb_we : std_logic := '0';
141
  signal wb_adr : std_logic_vector(7 downto 0) := (others => '0');
142
  signal wb_dat_m2s : std_logic_vector(7 downto 0) := (others => '0');
143
  signal wb_dat_s2m : std_logic_vector(7 downto 0) := (others => '0');
144
  signal wb_ack : std_logic := '0';
145
 
146
  signal pb_write_strobe : std_logic := '0';
147
  signal pb_read_strobe : std_logic := '0';
148
  signal pb_port_id : std_logic_vector(7 downto 0) := (others => '0');
149
  signal pb_in_port : std_logic_vector(7 downto 0) := (others => '0');
150
  signal pb_out_port : std_logic_vector(7 downto 0) := (others => '0');
151
 
152
  signal instruction : std_logic_vector(17 downto 0) := (others => '0');
153
  signal address : std_logic_vector(9 downto 0) := (others => '0');
154
 
155
  signal interrupt : std_logic := '0';
156
  signal interrupt_ack : std_logic := '0';
157
 
158
  signal timer : unsigned(23 downto 0) := (others => '0');
159
 
160
  signal dcm_locked : std_logic := '0';
161
 
162
begin
163
 
164
  -- 50 mhz clock generation
165
  DCM_SP_INST : DCM_SP
166
    generic map
167
    (
168
      CLK_FEEDBACK => "NONE",
169
      CLKDV_DIVIDE => 2.0,
170
      CLKFX_DIVIDE => 8,
171
      CLKFX_MULTIPLY => 25,
172
      CLKIN_DIVIDE_BY_2 => FALSE,
173
      CLKIN_PERIOD => 62.500,
174
      CLKOUT_PHASE_SHIFT => "NONE",
175
      DESKEW_ADJUST => "SYSTEM_SYNCHRONOUS",
176
      DFS_FREQUENCY_MODE => "LOW",
177
      DLL_FREQUENCY_MODE => "LOW",
178
      DUTY_CYCLE_CORRECTION => TRUE,
179
      FACTORY_JF => x"C080",
180
      PHASE_SHIFT => 0,
181
      STARTUP_WAIT => FALSE
182
    )
183
    port map
184
    (
185
      CLKFB => '0',
186
      CLKIN => CLK_16MHZ,
187
      DSSEN => '0',
188
      PSCLK => '0',
189
      PSEN => '0',
190
      PSINCDEC => '0',
191
      RST => FPGA_RESET,
192
      CLKDV => open,
193
      CLKFX => clk,
194
      CLKFX180 => open,
195
      CLK0 => open,
196
      CLK2X => open,
197
      CLK2X180 => open,
198
      CLK90 => open,
199
      CLK180 => open,
200
      CLK270 => open,
201
      LOCKED => dcm_locked,
202
      PSDONE => open,
203
      STATUS => open
204
    );
205
 
206
  -- reset synchronisation
207
  process(clk)
208
  begin
209
    rst <= not dcm_locked;
210
  end process;
211
 
212
  -- module instances
213
  -------------------
214
 
215
  inst_kcpsm3 : kcpsm3
216
    port map
217
    (
218
      address => address,
219
      instruction => instruction,
220
      port_id => pb_port_id,
221
      write_strobe => pb_write_strobe,
222
      out_port => pb_out_port,
223
      read_strobe => pb_read_strobe,
224
      in_port => pb_in_port,
225
      interrupt => interrupt,
226
      interrupt_ack => interrupt_ack,
227
      reset => rst,
228
      clk => clk
229
    );
230
 
231
  inst_pbwbuart : pbwbuart
232
    port map
233
    (
234
      address => address,
235
      instruction => instruction,
236
      clk => clk
237
    );
238
 
239
  inst_wbm_picoblaze : wbm_picoblaze
240
    port map
241
    (
242
      rst => rst,
243
      clk => clk,
244
 
245
      wbm_cyc_o => wb_cyc,
246
      wbm_stb_o => wb_stb,
247
      wbm_we_o => wb_we,
248
      wbm_adr_o => wb_adr,
249
      wbm_dat_m2s_o => wb_dat_m2s,
250
      wbm_dat_s2m_i => wb_dat_s2m,
251
      wbm_ack_i => wb_ack,
252
 
253
      pb_port_id_i => pb_port_id,
254
      pb_write_strobe_i => pb_write_strobe,
255
      pb_out_port_i => pb_out_port,
256
      pb_read_strobe_i => pb_read_strobe,
257
      pb_in_port_o => pb_in_port
258
    );
259
 
260
  inst_wbs_uart : wbs_uart
261
    port map
262
    (
263
      rst => rst,
264
      clk => clk,
265
 
266
      wbs_cyc_i => wb_cyc,
267
      wbs_stb_i => wb_stb,
268
      wbs_we_i => wb_we,
269
      wbs_adr_i => wb_adr,
270
      wbs_dat_m2s_i => wb_dat_m2s,
271
      wbs_dat_s2m_o => wb_dat_s2m,
272
      wbs_ack_o => wb_ack,
273
 
274
      uart_rx_si_i => UART_TXD,
275
      uart_tx_so_o => UART_RXD
276
    );
277
 
278
  LED1 <= timer(23);
279
 
280
  led_blinker : process(clk)
281
  begin
282
    if rising_edge(clk) then
283
      timer <= timer + 1;
284
      if rst = '1' then
285
        timer <= (others => '0');
286
      end if;
287
    end if;
288
  end process;
289
 
290
end rtl;

powered by: WebSVN 2.1.0

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