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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [rtl/] [picoblaze_wb_uart.vhd] - Blame information for rev 31

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 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) 2010, 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 12 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: picoblaze_wb_uart.vhd
32
-- description: synthesizable PicoBlaze (TM) uart example using wishbone
33
-- todo4user: add other modules as needed
34
-- version: 0.0.0
35
-- changelog: - 0.0.0, initial release
36
--            - ...
37
--------------------------------------------------------------------------------
38
 
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42
 
43
 
44
entity picoblaze_wb_uart is
45
  port
46
  (
47
    p_rst_n_i : in std_logic;
48
    p_clk_i : in std_logic;
49
 
50
    p_uart_rx_si_i : in std_logic;
51
    p_uart_tx_so_o : out std_logic
52
  );
53
end picoblaze_wb_uart;
54
 
55
 
56
architecture rtl of picoblaze_wb_uart is
57
 
58
  component kcpsm3 is
59
    port
60
    (
61
      address : out std_logic_vector(9 downto 0);
62
      instruction : in std_logic_vector(17 downto 0);
63
      port_id : out std_logic_vector(7 downto 0);
64
      write_strobe : out std_logic;
65
      out_port : out std_logic_vector(7 downto 0);
66
      read_strobe : out std_logic;
67
      in_port : in std_logic_vector(7 downto 0);
68
      interrupt : in std_logic;
69
      interrupt_ack : out std_logic;
70
      reset : in std_logic;
71
      clk : in std_logic
72
    );
73
  end component;
74
 
75
  component pbwbuart is
76
    port
77
    (
78
      address : in std_logic_vector(9 downto 0);
79
      instruction : out std_logic_vector(17 downto 0);
80
      clk : in std_logic
81
    );
82
  end component;
83
 
84
  component wbm_picoblaze is
85
    port
86
    (
87
      rst : in std_logic;
88
      clk : in std_logic;
89
 
90
      wbm_cyc_o : out std_logic;
91
      wbm_stb_o : out std_logic;
92
      wbm_we_o : out std_logic;
93
      wbm_adr_o : out std_logic_vector(7 downto 0);
94
      wbm_dat_m2s_o : out std_logic_vector(7 downto 0);
95
      wbm_dat_s2m_i : in std_logic_vector(7 downto 0);
96
      wbm_ack_i : in std_logic;
97
 
98
      pb_port_id_i : in std_logic_vector(7 downto 0);
99
      pb_write_strobe_i : in std_logic;
100
      pb_out_port_i : in std_logic_vector(7 downto 0);
101
      pb_read_strobe_i : in std_logic;
102
      pb_in_port_o : out std_logic_vector(7 downto 0)
103
    );
104
  end component;
105
 
106
  component wbs_uart is
107
    port
108
    (
109
      rst : in std_logic;
110
      clk : in std_logic;
111
 
112
      wbs_cyc_i : in std_logic;
113
      wbs_stb_i : in std_logic;
114
      wbs_we_i : in std_logic;
115
      wbs_adr_i : in std_logic_vector(7 downto 0);
116
      wbs_dat_m2s_i : in std_logic_vector(7 downto 0);
117
      wbs_dat_s2m_o : out std_logic_vector(7 downto 0);
118
      wbs_ack_o : out std_logic;
119
 
120
      uart_rx_si_i : in std_logic;
121
      uart_tx_so_o : out std_logic
122
    );
123
  end component;
124
 
125
  signal rst : std_logic := '1';
126
  signal clk : std_logic := '1';
127
 
128
  signal wb_cyc : std_logic := '0';
129
  signal wb_stb : std_logic := '0';
130
  signal wb_we : std_logic := '0';
131
  signal wb_adr : std_logic_vector(7 downto 0) := (others => '0');
132
  signal wb_dat_m2s : std_logic_vector(7 downto 0) := (others => '0');
133
  signal wb_dat_s2m : std_logic_vector(7 downto 0) := (others => '0');
134
  signal wb_ack : std_logic := '0';
135
 
136
  signal pb_write_strobe : std_logic := '0';
137
  signal pb_read_strobe : std_logic := '0';
138
  signal pb_port_id : std_logic_vector(7 downto 0) := (others => '0');
139
  signal pb_in_port : std_logic_vector(7 downto 0) := (others => '0');
140
  signal pb_out_port : std_logic_vector(7 downto 0) := (others => '0');
141
 
142
  signal instruction : std_logic_vector(17 downto 0) := (others => '0');
143
  signal address : std_logic_vector(9 downto 0) := (others => '0');
144
 
145
  signal interrupt : std_logic := '0';
146
  signal interrupt_ack : std_logic := '0';
147
 
148
begin
149
 
150
  -- reset synchronisation
151
  process(clk)
152
  begin
153 26 ste.fis
    if rising_edge(clk) then
154
      rst <= not p_rst_n_i;
155
    end if;
156 12 ste.fis
  end process;
157
  clk <= p_clk_i;
158
 
159
  -- module instances
160
  -------------------
161
 
162
  inst_kcpsm3 : kcpsm3
163
    port map
164
    (
165
      address => address,
166
      instruction => instruction,
167
      port_id => pb_port_id,
168
      write_strobe => pb_write_strobe,
169
      out_port => pb_out_port,
170
      read_strobe => pb_read_strobe,
171
      in_port => pb_in_port,
172
      interrupt => interrupt,
173
      interrupt_ack => interrupt_ack,
174
      reset => rst,
175
      clk => clk
176
    );
177
 
178
  inst_pbwbuart : pbwbuart
179
    port map
180
    (
181
      address => address,
182
      instruction => instruction,
183
      clk => clk
184
    );
185
 
186
  inst_wbm_picoblaze : wbm_picoblaze
187
    port map
188
    (
189
      rst => rst,
190
      clk => clk,
191
 
192
      wbm_cyc_o => wb_cyc,
193
      wbm_stb_o => wb_stb,
194
      wbm_we_o => wb_we,
195
      wbm_adr_o => wb_adr,
196
      wbm_dat_m2s_o => wb_dat_m2s,
197
      wbm_dat_s2m_i => wb_dat_s2m,
198
      wbm_ack_i => wb_ack,
199
 
200
      pb_port_id_i => pb_port_id,
201
      pb_write_strobe_i => pb_write_strobe,
202
      pb_out_port_i => pb_out_port,
203
      pb_read_strobe_i => pb_read_strobe,
204
      pb_in_port_o => pb_in_port
205
    );
206
 
207
  inst_wbs_uart : wbs_uart
208
    port map
209
    (
210
      rst => rst,
211
      clk => clk,
212
 
213
      wbs_cyc_i => wb_cyc,
214
      wbs_stb_i => wb_stb,
215
      wbs_we_i => wb_we,
216
      wbs_adr_i => wb_adr,
217
      wbs_dat_m2s_i => wb_dat_m2s,
218
      wbs_dat_s2m_o => wb_dat_s2m,
219
      wbs_ack_o => wb_ack,
220
 
221
      uart_rx_si_i => p_uart_rx_si_i,
222
      uart_tx_so_o => p_uart_tx_so_o
223
    );
224
 
225
end rtl;

powered by: WebSVN 2.1.0

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