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

Subversion Repositories yacc

[/] [yacc/] [trunk/] [syn/] [xilinx/] [s3_vsmpl.v] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tak.sugawa
/*
2
        Verilog Sample code for Spartan3 Starter Kit
3
 
4
        1.VGA
5
          RIGHT SIDE color bar
6
          line 1 : fixed message "PS2 Code Scanner By T.Satoh"
7
          line 2 to 29 : PS/2 code & UART monitor area
8
 
9
        2.PS/2 receive
10
          receive only,do not supported transmit
11
          display receive data to VGA monitor with HEXA code.
12
 
13
        3.7segment LED
14
          display second counter to low 2 digit
15
          display UART receive code to high 2 digit
16
          show second timming to DOT
17
          show button0,1,2 to DOT
18
 
19
        4.switch / LED
20
          echo switch level to LED
21
 
22
        5.button
23
          button3 = reset switch
24
          button2 = clear scan code display
25
          button1 = no function
26
          button0 = no function
27
 
28
        6.RS232C
29
          receive only,do not support transmit
30
          TX pin is LOOPBACK from RX pin.
31
          Receive 38400bps,8bit,no-parity,1stop
32
 
33
        7.SRAM
34
          do not used
35
 
36
        8.ROM data from configration ROM
37
          do not used
38
 
39
*/
40
module s3_vsmpl(
41
  tx,rx,switch,button,led,
42
  led7seg , led7com,
43
  ram_addr , ram_we,ram_oe,
44
  ram_a_data,ram_a_ce,ram_a_lb,ram_a_ub,
45
  ram_b_data,ram_b_ce,ram_b_lb,ram_b_ub,
46
  din,cclk,reset_prom,
47
  clk,
48
// PS2
49
   PS2_CLK,PS2_DATA
50
// VGA
51
  ,VGA_R,VGA_G,VGA_B,VGA_HS,VGA_VS
52
);
53
 
54
/****************************************************************************
55
  I/O PIN description
56
****************************************************************************/
57
 
58
// PS2 keyboard / mouse
59
input PS2_CLK;
60
input PS2_DATA;
61
 
62
// VGA monitor
63
output VGA_R,VGA_G,VGA_B;
64
output VGA_HS,VGA_VS;
65
 
66
// RS232C serial port
67
output tx;
68
input rx;
69
 
70
// switch & button
71
input [7:0] switch;
72
input [3:0] button;
73
 
74
// static LED
75
output [7:0] led;
76
 
77
// 7segment LED
78
output [7:0] led7seg;
79
output [3:0] led7com;
80
 
81
// SRAM
82
output [17:0] ram_addr;
83
output ram_we , ram_oe;
84
inout [15:0] ram_a_data;
85
output ram_a_ce;
86
output ram_a_lb;
87
output ram_a_ub;
88
inout [15:0] ram_b_data;
89
output ram_b_ce;
90
output ram_b_lb;
91
output ram_b_ub;
92
 
93
// CFG ROM
94
inout din;
95
output cclk;
96
output reset_prom;
97
 
98
// 50MHz clock
99
input clk;
100
 
101
//Hard Top
102
 
103
  assign led7seg=0;
104
  assign led7com=0;
105
 
106
        assign VGA_R=0,VGA_G=0,VGA_B=0;
107
   assign VGA_HS=0,VGA_VS=0;
108
 
109
 
110
/****************************************************************************
111
  reset signal
112
****************************************************************************/
113
wire user_reset = button[3];
114
 
115
/****************************************************************************
116
  basic clock generator
117
****************************************************************************/
118
wire clk50M = clk;
119
reg r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16;
120
always @(negedge clk50M )  begin//power on reset
121
                r1<=user_reset;
122
                r2<=r1;
123
                r3<=r2;
124
                r4<=r3;
125
                r5<=r4;
126
                r6<=r5;
127
                r7<=r6;
128
                r8<=r7;
129
                r9<=r8;
130
          r10<=r9;
131
                r11<=r10;
132
                r12<=r11;
133
                r13<=r12;
134
                r14<=r13;
135
                r15<=r14;
136
                r16<=r15;
137
end
138
// divider
139
reg [1:0] clk25M;
140
 
141
always @(posedge clk50M )
142
           if (r1)  clk25M<=0;
143
           else  clk25M <= clk25M+1;
144
 
145
 
146
 
147
 yacc cpu(.clock(clk25M[0]),//25MHz
148
                                        .Async_Reset(!r16),
149
                            .RXD(rx),
150
                                        .TXD(tx));
151
 
152
 
153
/****************************************************************************
154
  unused I/O
155
****************************************************************************/
156
 
157
// RS232C serial port , LOOP back
158
//assign tx = rx;
159
 
160
assign led = switch;
161
 
162
// SRAM
163
assign ram_addr = 0;
164
assign ram_we = 0;
165
assign ram_oe = 1'b1;
166
 
167
assign ram_a_data = 16'hffff;
168
assign ram_a_ce = 1'b1;
169
assign ram_a_lb = 1'b1;
170
assign ram_a_ub = 1'b1;
171
assign ram_b_data = 16'hffff;
172
assign ram_b_ce = 1'b1;
173
assign ram_b_lb = 1'b1;
174
assign ram_b_ub = 1'b1;
175
 
176
// CFG ROM
177
assign cclk = din;
178
assign reset_prom = din;
179
 
180
endmodule

powered by: WebSVN 2.1.0

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