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 31

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

powered by: WebSVN 2.1.0

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