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

powered by: WebSVN 2.1.0

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