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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [impl/] [avnet_sp3a_eval_gpio_vlog.v] - 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_gpio_vlog.v
35
// description: synthesizable PicoBlaze (TM) general purpose i/o example using 
36
//              wishbone / 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
module avnet_sp3a_eval_gpio_vlog (
45
  FPGA_RESET,
46
  CLK_16MHZ,
47
 
48
  FPGA_PUSH_A,
49
  FPGA_PUSH_B,
50
  FPGA_PUSH_C,
51
 
52
  LED1,
53
  LED2,
54
  LED3,
55
  LED4
56
);
57
 
58
  input FPGA_RESET;
59
  wire  FPGA_RESET;
60
  input CLK_16MHZ;
61
  wire  CLK_16MHZ;
62
 
63
  input FPGA_PUSH_A;
64
  wire  FPGA_PUSH_A;
65
  input FPGA_PUSH_B;
66
  wire  FPGA_PUSH_B;
67
  input FPGA_PUSH_C;
68
  wire  FPGA_PUSH_C;
69
 
70
  output LED1;
71
  wire   LED1;
72
  output LED2;
73
  wire   LED2;
74
  output LED3;
75
  wire   LED3;
76
  output LED4;
77
  wire   LED4;
78
 
79
  reg rst;
80
  wire clk;
81
 
82
  wire wb_cyc;
83
  wire wb_stb;
84
  wire wb_we;
85
  wire[7:0] wb_adr;
86
  wire[7:0] wb_dat_m2s;
87
  wire[7:0] wb_dat_s2m;
88
  wire wb_ack;
89
 
90
  wire pb_write_strobe;
91
  wire pb_read_strobe;
92
  wire[7:0] pb_port_id;
93
  wire[7:0] pb_in_port;
94
  wire[7:0] pb_out_port;
95
 
96
  wire[17:0] instruction;
97
  wire[9:0] address;
98
 
99
  wire interrupt;
100
  wire interrupt_ack;
101
 
102
  wire[7:0] gpio_in;
103
  wire[7:0] gpio_out;
104
  wire[7:0] gpio_oe;
105
 
106
  reg[23:0] timer;
107
 
108
  // reset synchronisation
109
  always@(clk)
110
    rst <= FPGA_RESET;
111
  assign clk = CLK_16MHZ;
112
 
113
  // module instances
114
  ///////////////////
115
 
116
  kcpsm3 inst_kcpsm3 (
117
    .address(address),
118
    .instruction(instruction),
119
    .port_id(pb_port_id),
120
    .write_strobe(pb_write_strobe),
121
    .out_port(pb_out_port),
122
    .read_strobe(pb_read_strobe),
123
    .in_port(pb_in_port),
124
    .interrupt(interrupt),
125
    .interrupt_ack(interrupt_ack),
126
    .reset(rst),
127
    .clk(clk)
128
  );
129
 
130
  pbwbgpio inst_pbwbgpio (
131
    .address(address),
132
    .instruction(instruction),
133
    .clk(clk)
134
  );
135
 
136
  wbm_picoblaze inst_wbm_picoblaze (
137
    .rst(rst),
138
    .clk(clk),
139
 
140
    .wbm_cyc_o(wb_cyc),
141
    .wbm_stb_o(wb_stb),
142
    .wbm_we_o(wb_we),
143
    .wbm_adr_o(wb_adr),
144
    .wbm_dat_m2s_o(wb_dat_m2s),
145
    .wbm_dat_s2m_i(wb_dat_s2m),
146
    .wbm_ack_i(wb_ack),
147
 
148
    .pb_port_id_i(pb_port_id),
149
    .pb_write_strobe_i(pb_write_strobe),
150
    .pb_out_port_i(pb_out_port),
151
    .pb_read_strobe_i(pb_read_strobe),
152
    .pb_in_port_o(pb_in_port)
153
  );
154
 
155
  wbs_gpio inst_wbs_gpio (
156
    .rst(rst),
157
    .clk(clk),
158
 
159
    .wbs_cyc_i(wb_cyc),
160
    .wbs_stb_i(wb_stb),
161
    .wbs_we_i(wb_we),
162
    .wbs_adr_i(wb_adr),
163
    .wbs_dat_m2s_i(wb_dat_m2s),
164
    .wbs_dat_s2m_o(wb_dat_s2m),
165
    .wbs_ack_o(wb_ack),
166
 
167
    .gpio_in_i(gpio_in),
168
    .gpio_out_o(gpio_out),
169
    .gpio_oe_o(gpio_oe)
170
  );
171
 
172
  // i/o buffer generation
173
 
174
  assign gpio_in = {
175
    1'b0,
176
    FPGA_PUSH_C,
177
    FPGA_PUSH_B,
178
    FPGA_PUSH_A,
179
    {4{1'b0}}
180
  };
181
 
182
  assign LED1 = gpio_out[0];
183
  assign LED2 = gpio_out[1];
184
  assign LED3 = gpio_out[2];
185
  assign LED4 = timer[23];
186
 
187
  always@(posedge clk) begin : led_blinker
188
    timer <= timer + 1;
189
    if (rst)
190
      timer <= {24{1'b0}};
191
  end
192
 
193
endmodule

powered by: WebSVN 2.1.0

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