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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [impl/] [avnet_sp3a_eval_gpio_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_gpio_vhd.vhd
32
-- description: synthesizable PicoBlaze (TM) general purpose i/o example using 
33
--              wishbone / 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
 
46
entity avnet_sp3a_eval_gpio_vhd is
47
  port
48
  (
49
    FPGA_RESET : in std_logic;
50
    CLK_16MHZ : in std_logic;
51
 
52
    FPGA_PUSH_A : in std_logic;
53
    FPGA_PUSH_B : in std_logic;
54
    FPGA_PUSH_C : in std_logic;
55
 
56
    LED1 : out std_logic;
57
    LED2 : out std_logic;
58
    LED3 : out std_logic;
59
    LED4 : out std_logic
60
  );
61
end avnet_sp3a_eval_gpio_vhd;
62
 
63
 
64
architecture rtl of avnet_sp3a_eval_gpio_vhd is
65
 
66
  component kcpsm3 is
67
    port
68
    (
69
      address : out std_logic_vector(9 downto 0);
70
      instruction : in std_logic_vector(17 downto 0);
71
      port_id : out std_logic_vector(7 downto 0);
72
      write_strobe : out std_logic;
73
      out_port : out std_logic_vector(7 downto 0);
74
      read_strobe : out std_logic;
75
      in_port : in std_logic_vector(7 downto 0);
76
      interrupt : in std_logic;
77
      interrupt_ack : out std_logic;
78
      reset : in std_logic;
79
      clk : in std_logic
80
    );
81
  end component;
82
 
83
  component pbwbgpio is
84
    port
85
    (
86
      address : in std_logic_vector(9 downto 0);
87
      instruction : out std_logic_vector(17 downto 0);
88
      clk : in std_logic
89
    );
90
  end component;
91
 
92
  component wbm_picoblaze is
93
    port
94
    (
95
      rst : in std_logic;
96
      clk : in std_logic;
97
 
98
      wbm_cyc_o : out std_logic;
99
      wbm_stb_o : out std_logic;
100
      wbm_we_o : out std_logic;
101
      wbm_adr_o : out std_logic_vector(7 downto 0);
102
      wbm_dat_m2s_o : out std_logic_vector(7 downto 0);
103
      wbm_dat_s2m_i : in std_logic_vector(7 downto 0);
104
      wbm_ack_i : in std_logic;
105
 
106
      pb_port_id_i : in std_logic_vector(7 downto 0);
107
      pb_write_strobe_i : in std_logic;
108
      pb_out_port_i : in std_logic_vector(7 downto 0);
109
      pb_read_strobe_i : in std_logic;
110
      pb_in_port_o : out std_logic_vector(7 downto 0)
111
    );
112
  end component;
113
 
114
  component wbs_gpio is
115
    port
116
    (
117
      rst : in std_logic;
118
      clk : in std_logic;
119
 
120
      wbs_cyc_i : in std_logic;
121
      wbs_stb_i : in std_logic;
122
      wbs_we_i : in std_logic;
123
      wbs_adr_i : in std_logic_vector(7 downto 0);
124
      wbs_dat_m2s_i : in std_logic_vector(7 downto 0);
125
      wbs_dat_s2m_o : out std_logic_vector(7 downto 0);
126
      wbs_ack_o : out std_logic;
127
 
128
      gpio_in_i : in std_logic_vector(7 downto 0);
129
      gpio_out_o : out std_logic_vector(7 downto 0);
130
      gpio_oe_o : out std_logic_vector(7 downto 0)
131
    );
132
  end component;
133
 
134
  signal rst : std_logic := '1';
135
  signal clk : std_logic := '1';
136
 
137
  signal wb_cyc : std_logic := '0';
138
  signal wb_stb : std_logic := '0';
139
  signal wb_we : std_logic := '0';
140
  signal wb_adr : std_logic_vector(7 downto 0) := (others => '0');
141
  signal wb_dat_m2s : std_logic_vector(7 downto 0) := (others => '0');
142
  signal wb_dat_s2m : std_logic_vector(7 downto 0) := (others => '0');
143
  signal wb_ack : std_logic := '0';
144
 
145
  signal pb_write_strobe : std_logic := '0';
146
  signal pb_read_strobe : std_logic := '0';
147
  signal pb_port_id : std_logic_vector(7 downto 0) := (others => '0');
148
  signal pb_in_port : std_logic_vector(7 downto 0) := (others => '0');
149
  signal pb_out_port : std_logic_vector(7 downto 0) := (others => '0');
150
 
151
  signal instruction : std_logic_vector(17 downto 0) := (others => '0');
152
  signal address : std_logic_vector(9 downto 0) := (others => '0');
153
 
154
  signal interrupt : std_logic := '0';
155
  signal interrupt_ack : std_logic := '0';
156
 
157
  signal gpio_in : std_logic_vector(7 downto 0) := (others => '0');
158
  signal gpio_out : std_logic_vector(7 downto 0) := (others => '0');
159
  signal gpio_oe : std_logic_vector(7 downto 0) := (others => '0');
160
 
161
  signal timer : unsigned(23 downto 0) := (others => '0');
162
 
163
begin
164
 
165
  -- reset synchronisation
166
  process(clk)
167
  begin
168 28 ste.fis
    if rising_edge(clk) then
169
      rst <= FPGA_RESET;
170
    end if;
171 24 ste.fis
  end process;
172
  clk <= CLK_16MHZ;
173
 
174
  -- module instances
175
  -------------------
176
 
177
  inst_kcpsm3 : kcpsm3
178
    port map
179
    (
180
      address => address,
181
      instruction => instruction,
182
      port_id => pb_port_id,
183
      write_strobe => pb_write_strobe,
184
      out_port => pb_out_port,
185
      read_strobe => pb_read_strobe,
186
      in_port => pb_in_port,
187
      interrupt => interrupt,
188
      interrupt_ack => interrupt_ack,
189
      reset => rst,
190
      clk => clk
191
    );
192
 
193
  inst_pbwbgpio : pbwbgpio
194
    port map
195
    (
196
      address => address,
197
      instruction => instruction,
198
      clk => clk
199
    );
200
 
201
  inst_wbm_picoblaze : wbm_picoblaze
202
    port map
203
    (
204
      rst => rst,
205
      clk => clk,
206
 
207
      wbm_cyc_o => wb_cyc,
208
      wbm_stb_o => wb_stb,
209
      wbm_we_o => wb_we,
210
      wbm_adr_o => wb_adr,
211
      wbm_dat_m2s_o => wb_dat_m2s,
212
      wbm_dat_s2m_i => wb_dat_s2m,
213
      wbm_ack_i => wb_ack,
214
 
215
      pb_port_id_i => pb_port_id,
216
      pb_write_strobe_i => pb_write_strobe,
217
      pb_out_port_i => pb_out_port,
218
      pb_read_strobe_i => pb_read_strobe,
219
      pb_in_port_o => pb_in_port
220
    );
221
 
222
  inst_wbs_gpio : wbs_gpio
223
    port map
224
    (
225
      rst => rst,
226
      clk => clk,
227
 
228
      wbs_cyc_i => wb_cyc,
229
      wbs_stb_i => wb_stb,
230
      wbs_we_i => wb_we,
231
      wbs_adr_i => wb_adr,
232
      wbs_dat_m2s_i => wb_dat_m2s,
233
      wbs_dat_s2m_o => wb_dat_s2m,
234
      wbs_ack_o => wb_ack,
235
 
236
      gpio_in_i => gpio_in,
237
      gpio_out_o => gpio_out,
238
      gpio_oe_o => gpio_oe
239
    );
240
 
241
  -- i/o buffer generation
242
 
243
  gpio_in <= (
244
    4 => FPGA_PUSH_A,
245
    5 => FPGA_PUSH_B,
246
    6 => FPGA_PUSH_C,
247
    others => '0'
248
  );
249
 
250
  LED1 <= gpio_out(0);
251
  LED2 <= gpio_out(1);
252
  LED3 <= gpio_out(2);
253
  LED4 <= timer(23);
254
 
255
  led_blinker : process(clk)
256
  begin
257
    if rising_edge(clk) then
258
      timer <= timer + 1;
259
      if rst = '1' then
260
        timer <= (others => '0');
261
      end if;
262
    end if;
263
  end process;
264
 
265
end rtl;

powered by: WebSVN 2.1.0

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