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

Subversion Repositories wb_lcd

[/] [wb_lcd/] [trunk/] [myhdl/] [wb_lcd_workspace_ramless/] [boards/] [s3esk-mm_lcd/] [rtl/] [system.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jvillar
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  system.v                                                    ////
4
////                                                              ////
5
////  This file is part of:                                       ////
6
////  WISHBONE/MEM MAPPED CONTROLLER FOR LCD CHARACTER DISPLAYS   ////
7
////  http://www.opencores.org/projects/wb_lcd/                   ////
8
////                                                              ////
9
////  Description                                                 ////
10
////   - Memory mapped controller testbench implementation for    ////
11
////     Spartan 3E Starter Kit (XC3S500E) board from Digilent.   ////
12
////  To Do:                                                      ////
13
////   - nothing really                                           ////
14
////                                                              ////
15
////  Author(s):                                                  ////
16
////   - José Ignacio Villar, jose@dte.us.es , jvillar@gmail.com  ////
17
////      - Grupo ID2 http://www.dte.us.es/id2/                   ////
18
////                                                              ////
19
//////////////////////////////////////////////////////////////////////
20
////                                                              ////
21
//// Copyright (C) 2009 José Ignacio Villar - jvillar@gmail.com   ////
22
////                                                              ////
23
//// This source file may be used and distributed without         ////
24
//// restriction provided that this copyright statement is not    ////
25
//// removed from the file and that any derivative work contains  ////
26
//// the original copyright notice and the associated disclaimer. ////
27
////                                                              ////
28
//// This source file is free software; you can redistribute it   ////
29
//// and/or modify it under the terms of the GNU Lesser General   ////
30
//// Public License as published by the Free Software Foundation; ////
31
//// either version 3 of the License, or (at your option) any     ////
32
//// later version.                                               ////
33
////                                                              ////
34
//// This source is distributed in the hope that it will be       ////
35
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
36
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
37
//// PURPOSE.  See the GNU Lesser General Public License for more ////
38
//// details.                                                     ////
39
////                                                              ////
40
//// You should have received a copy of the GNU Lesser General    ////
41
//// Public License along with this source; if not, download it   ////
42
//// from http://www.gnu.org/licenses/lgpl.txt                    ////
43
////                                                              ////
44
//////////////////////////////////////////////////////////////////////
45
 
46
`include "lcd_defines.v"
47
 
48
module system(
49
        input clk,
50
        input reset,
51
 
52
        input  [2:0] rot,
53
 
54
        output [3:0] SF_D,
55
        output LCD_E,
56
        output LCD_RS,
57
        output LCD_RW,
58
        output SF_CE0,
59
 
60
        output reg [7:0] led
61
        );
62
 
63
//----------------------------------------------------------------------------
64
// rotary decoder
65
//----------------------------------------------------------------------------
66
wire rot_btn;
67
wire rot_event;
68
wire rot_left;
69
 
70
rotary rotdec0 (
71
        .clk(       clk        ),
72
        .reset(     reset      ),
73
        .rot(       rot        ),
74
        // output
75
        .rot_btn(   rot_btn    ),
76
        .rot_event( rot_event  ),
77
        .rot_left(  rot_left   )
78
);
79
 
80
//----------------------------------------------------------------------------
81
// LCD Display
82
//----------------------------------------------------------------------------
83
 
84
 
85
wire busy;
86
reg [`DAT_RNG]  dat = 8'b00100000;
87
reg [`ADDR_RNG] addr = 0;
88
wire we;
89
 
90
 
91
 
92
lcd lcd(
93
        .clk    ( clk ),
94
        .reset  ( reset),
95
 
96
        .dat    ( dat ),
97
        .addr   ( addr ),
98
        .we     ( we ),
99
        .busy   ( busy ),
100
        .SF_D   ( SF_D ),
101
        .LCD_E  ( LCD_E ),
102
        .LCD_RS ( LCD_RS ),
103
        .LCD_RW ( LCD_RW )
104
 
105
        );
106
 
107
 
108
 
109
//----------------------------------------------------------------------------
110
// Behavioural description
111
//----------------------------------------------------------------------------
112
assign SF_CE0 = 1'b1; // disable intel strataflash
113
integer i = 0;
114
assign we = (i < 104) & ~busy;
115
 
116
// Handles "start displaying character" shift
117
reg [`DAT_RNG]  start_dat = 8'b00100000;
118
 
119
 
120
 
121
// Handles transfers to the display
122
 
123
always @(posedge clk)
124
begin
125
        if(reset) begin
126
                i <= 0;
127
                addr <= 0;
128
                dat <= start_dat;
129
 
130
                led <= 8'b00100000;
131
                start_dat <= 8'b00100000;
132
        end else begin
133
                if (i < 104 && !busy) begin
134
                        i <= i + 1;
135
                        addr <= addr + 1;
136
                        dat <= dat + 1;
137
                end else if (rot_event && rot_left && !busy) begin
138
                        i <= 0;
139
                        led <= led - 1;
140
                        start_dat <= start_dat - 1;
141
 
142
                        addr <= 0;
143
                        dat <= start_dat - 1;
144
                end else if (rot_event && !busy) begin
145
                        i <= 0;
146
                        led <= led + 1;
147
                        start_dat <= start_dat + 1;
148
 
149
                        addr <= 0;
150
                        dat <= start_dat + 1;
151
                end
152
        end
153
end
154
 
155
 
156
endmodule

powered by: WebSVN 2.1.0

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