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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [impl/] [avnet_sp3a_eval_uart_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_uart_vlog.v
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
module avnet_sp3a_eval_uart_vlog (
42
  FPGA_RESET,
43
  CLK_16MHZ,
44
 
45
  UART_TXD,
46
  UART_RXD,
47
 
48
  LED1
49
);
50
 
51
  input FPGA_RESET;
52
  wire  FPGA_RESET;
53
  input CLK_16MHZ;
54
  wire  CLK_16MHZ;
55
 
56
  input UART_TXD;
57
  wire  UART_TXD;
58
  output UART_RXD;
59
  wire   UART_RXD;
60
 
61
  output LED1;
62
  wire   LED1;
63
 
64
  reg rst;
65
  wire clk;
66
 
67
  wire wb_cyc;
68
  wire wb_stb;
69
  wire wb_we;
70
  wire[7:0] wb_adr;
71
  wire[7:0] wb_dat_m2s;
72
  wire[7:0] wb_dat_s2m;
73
  wire wb_ack;
74
 
75
  wire pb_write_strobe;
76
  wire pb_read_strobe;
77
  wire[7:0] pb_port_id;
78
  wire[7:0] pb_in_port;
79
  wire[7:0] pb_out_port;
80
 
81
  wire[17:0] instruction;
82
  wire[9:0] address;
83
 
84
  wire interrupt;
85
  wire interrupt_ack;
86
 
87
  reg[23:0] timer;
88
 
89
  wire dcm_locked;
90
 
91
  // 50 mhz clock generation
92
  DCM_SP # (
93
    .CLK_FEEDBACK("NONE"),
94
    .CLKDV_DIVIDE(2.0),
95
    .CLKFX_DIVIDE(8),
96
    .CLKFX_MULTIPLY(25),
97
    .CLKIN_DIVIDE_BY_2("FALSE"),
98
    .CLKIN_PERIOD(62.500),
99
    .CLKOUT_PHASE_SHIFT("NONE"),
100
    .DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"),
101
    .DFS_FREQUENCY_MODE("LOW"),
102
    .DLL_FREQUENCY_MODE("LOW"),
103
    .DUTY_CYCLE_CORRECTION("TRUE"),
104
    .FACTORY_JF(16'hC080),
105
    .PHASE_SHIFT(0),
106
    .STARTUP_WAIT("FALSE")
107
  )
108
  DCM_SP_INST (
109
    .CLKFB(1'B0),
110
    .CLKIN(CLK_16MHZ),
111
    .DSSEN(1'B0),
112
    .PSCLK(1'B0),
113
    .PSEN(1'B0),
114
    .PSINCDEC(1'B0),
115
    .RST(FPGA_RESET),
116
    .CLKDV(),
117
    .CLKFX(clk),
118
    .CLKFX180(),
119
    .CLK0(),
120
    .CLK2X(),
121
    .CLK2X180(),
122
    .CLK90(),
123
    .CLK180(),
124
    .CLK270(),
125
    .LOCKED(dcm_locked),
126
    .PSDONE(),
127
    .STATUS()
128
  );
129
 
130
  // reset synchronisation
131 28 ste.fis
  always@(negedge dcm_locked or posedge clk)
132
    if (! dcm_locked)
133
      rst <= 1'b1;
134
    else
135
      rst <= ! dcm_locked;
136 24 ste.fis
 
137
  // module instances
138
  ///////////////////
139
 
140
  kcpsm3 inst_kcpsm3 (
141
    .address(address),
142
    .instruction(instruction),
143
    .port_id(pb_port_id),
144
    .write_strobe(pb_write_strobe),
145
    .out_port(pb_out_port),
146
    .read_strobe(pb_read_strobe),
147
    .in_port(pb_in_port),
148
    .interrupt(interrupt),
149
    .interrupt_ack(interrupt_ack),
150
    .reset(rst),
151
    .clk(clk)
152
  );
153
 
154
  pbwbuart inst_pbwbuart (
155
    .address(address),
156
    .instruction(instruction),
157
    .clk(clk)
158
  );
159
 
160
  wbm_picoblaze inst_wbm_picoblaze (
161
    .rst(rst),
162
    .clk(clk),
163
 
164
    .wbm_cyc_o(wb_cyc),
165
    .wbm_stb_o(wb_stb),
166
    .wbm_we_o(wb_we),
167
    .wbm_adr_o(wb_adr),
168
    .wbm_dat_m2s_o(wb_dat_m2s),
169
    .wbm_dat_s2m_i(wb_dat_s2m),
170
    .wbm_ack_i(wb_ack),
171
 
172
    .pb_port_id_i(pb_port_id),
173
    .pb_write_strobe_i(pb_write_strobe),
174
    .pb_out_port_i(pb_out_port),
175
    .pb_read_strobe_i(pb_read_strobe),
176
    .pb_in_port_o(pb_in_port)
177
  );
178
 
179
  wbs_uart inst_wbs_uart (
180
    .rst(rst),
181
    .clk(clk),
182
 
183
    .wbs_cyc_i(wb_cyc),
184
    .wbs_stb_i(wb_stb),
185
    .wbs_we_i(wb_we),
186
    .wbs_adr_i(wb_adr),
187
    .wbs_dat_m2s_i(wb_dat_m2s),
188
    .wbs_dat_s2m_o(wb_dat_s2m),
189
    .wbs_ack_o(wb_ack),
190
 
191
    .uart_rx_si_i(UART_TXD),
192
    .uart_tx_so_o(UART_RXD)
193
  );
194
 
195
  assign LED1 = timer[23];
196
 
197
  always@(posedge clk) begin : led_blinker
198
    timer <= timer + 1;
199
    if (rst)
200
      timer <= {24{1'b0}};
201
  end
202
 
203
endmodule

powered by: WebSVN 2.1.0

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