OpenCores
URL https://opencores.org/ocsvn/connect-6/connect-6/trunk

Subversion Repositories connect-6

[/] [connect-6/] [trunk/] [BUILD_SCC/] [DE2/] [LCD_TEST_SAFE.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 4 sumanta.ch
module  LCD_TEST (      //      Host Side
2
                                        iCLK,iRST_N,msg_in,
3
                                        //      LCD Side
4
                                        LCD_DATA,LCD_RW,LCD_EN,LCD_RS   );
5
//      Host Side
6
input                   iCLK,iRST_N;
7
input   [2:0]            msg_in;
8
//      LCD Side
9
output  [7:0]    LCD_DATA;
10
output                  LCD_RW,LCD_EN,LCD_RS;
11
//      Internal Wires/Registers
12
reg     [5:0]    LUT_INDEX;
13
reg[5:0] LUT_INDEX_NEXT;
14
reg     [8:0]    LUT_DATA;
15
reg     [5:0]    mLCD_ST,mLCD_nxt_ST;
16
reg     [17:0]   mDLY;
17
reg     [17:0]   mDLY_NEXT;
18
reg                     mLCD_Start;
19
reg                     mLCD_Start_NEXT;
20
reg     [7:0]    mLCD_DATA;
21
reg                     mLCD_RS;
22
reg [2:0] msg_in_int;
23
wire            mLCD_Done;
24
 
25
parameter       LCD_INTIAL      =       0;
26
parameter       LCD_LINE1       =       5;
27
parameter       LCD_CH_LINE     =       LCD_LINE1+16;
28
parameter       LCD_LINE2       =       LCD_LINE1+16+1;
29
parameter       LUT_SIZE        =       LCD_LINE1+32+1;
30
 
31
always@(posedge iCLK or negedge iRST_N)
32
begin
33
        if(!iRST_N)
34
        begin
35
                mLCD_ST<=4;
36
                mLCD_DATA       <=      0;
37
                mLCD_RS         <=      0;
38
                msg_in_int  <=  0;
39
        end
40
        else
41
        begin
42
                mLCD_ST<=mLCD_nxt_ST;
43
                LUT_INDEX<=LUT_INDEX_NEXT;
44
                mDLY<=mDLY_NEXT;
45
                mLCD_Start<=mLCD_Start_NEXT;
46
                msg_in_int<=msg_in;
47
                mLCD_DATA       <=      LUT_DATA[7:0];
48
                mLCD_RS         <=      LUT_DATA[8];
49
        end
50
end
51
 
52
 
53
//always@(mLCD_ST or msg_in or msg_in_int or LUT_INDEX or LUT_DATA or msg_in_int)
54
always@(*)
55
        begin
56
                        case(mLCD_ST)
57
                        0:       begin
58
                                        mLCD_Start_NEXT <=      1;
59
                                        mDLY_NEXT       <=      mDLY;
60
                                        if(msg_in_int!=msg_in)
61
                                                begin
62
                                                        LUT_INDEX_NEXT<=0;
63
                                                end
64
                                        else begin
65
                                                        LUT_INDEX_NEXT<=LUT_INDEX;
66
                                                 end
67
 
68
                                        if( LUT_INDEX<LUT_SIZE)
69
                                                mLCD_nxt_ST             <=      1;
70
                                        else
71
                                                mLCD_nxt_ST             <=      0;
72
                                end
73
                        1:      begin
74
                                        mDLY_NEXT       <=      mDLY;
75
                                        LUT_INDEX_NEXT<=LUT_INDEX;
76
                                        if(mLCD_Done)
77
                                        begin
78
                                                mLCD_Start_NEXT <=      0;
79
                                                mLCD_nxt_ST             <=      2;
80
                                        end
81
                                        else begin
82
                                                mLCD_Start_NEXT <=      mLCD_Start;
83
                                                mLCD_nxt_ST             <=      1;
84
                                        end
85
 
86
                                end
87
                        2:      begin
88
                                        mLCD_Start_NEXT <=      mLCD_Start;
89
                                        LUT_INDEX_NEXT<=LUT_INDEX;
90
                                        if(mDLY<18'h3FFFE)
91
                                        begin
92
                                                mDLY_NEXT       <=      mDLY+1;
93
                                                mLCD_nxt_ST     <=      2;
94
                                        end
95
                                        else
96
                                        begin
97
                                                mDLY_NEXT       <=      0;
98
                                                mLCD_nxt_ST     <=      3;
99
                                        end
100
                                end
101
                        3:      begin
102
                                        mLCD_Start_NEXT <=      mLCD_Start;
103
                                        mDLY_NEXT       <=      mDLY;
104
                                        LUT_INDEX_NEXT  <=      LUT_INDEX+1;
105
                                        mLCD_nxt_ST     <=      0;
106
                                end
107
                        4:      begin
108
                                        mLCD_Start_NEXT <=      0;
109
                                        LUT_INDEX_NEXT  <=      0;
110
                                        mLCD_nxt_ST     <=      0;
111
                                        mDLY_NEXT       <=      0;
112
 
113
                                end
114
                        default: begin
115
                                end
116
                        endcase
117
        end
118
 
119
always
120
begin
121
case(msg_in_int)
122
3'b000:
123
        case(LUT_INDEX)
124
        //      Initial
125
        LCD_INTIAL+0:    LUT_DATA        <=      9'h038;
126
        LCD_INTIAL+1:   LUT_DATA        <=      9'h00C;
127
        LCD_INTIAL+2:   LUT_DATA        <=      9'h001;
128
        LCD_INTIAL+3:   LUT_DATA        <=      9'h006;
129
        LCD_INTIAL+4:   LUT_DATA        <=      9'h080;
130
        //      Line 1
131
        LCD_LINE1+0:     LUT_DATA        <=      9'h142; //      Banc-d-Test SAFE
132
        LCD_LINE1+1:    LUT_DATA        <=      9'h161;
133
        LCD_LINE1+2:    LUT_DATA        <=      9'h16E;
134
        LCD_LINE1+3:    LUT_DATA        <=      9'h163;
135
        LCD_LINE1+4:    LUT_DATA        <=      9'h12D;
136
        LCD_LINE1+5:    LUT_DATA        <=      9'h164;
137
        LCD_LINE1+6:    LUT_DATA        <=      9'h12D;
138
        LCD_LINE1+7:    LUT_DATA        <=      9'h154;
139
        LCD_LINE1+8:    LUT_DATA        <=      9'h165;
140
        LCD_LINE1+9:    LUT_DATA        <=      9'h173;
141
        LCD_LINE1+10:   LUT_DATA        <=      9'h174;
142
        LCD_LINE1+11:   LUT_DATA        <=      9'h120;
143
        LCD_LINE1+12:   LUT_DATA        <=      9'h153;
144
        LCD_LINE1+13:   LUT_DATA        <=      9'h141;
145
        LCD_LINE1+14:   LUT_DATA        <=      9'h146;
146
        LCD_LINE1+15:   LUT_DATA        <=      9'h145;
147
        //      Change Line
148
        LCD_CH_LINE:    LUT_DATA        <=      9'h0C0;
149
        //      Line 2
150
        LCD_LINE2+0:     LUT_DATA        <=      9'h142; //      Bienvenue A Bord
151
        LCD_LINE2+1:    LUT_DATA        <=      9'h169;
152
        LCD_LINE2+2:    LUT_DATA        <=      9'h165;
153
        LCD_LINE2+3:    LUT_DATA        <=      9'h16E;
154
        LCD_LINE2+4:    LUT_DATA        <=      9'h176;
155
        LCD_LINE2+5:    LUT_DATA        <=      9'h165;
156
        LCD_LINE2+6:    LUT_DATA        <=      9'h16E;
157
        LCD_LINE2+7:    LUT_DATA        <=      9'h175;
158
        LCD_LINE2+8:    LUT_DATA        <=      9'h165;
159
        LCD_LINE2+9:    LUT_DATA        <=      9'h120;
160
        LCD_LINE2+10:   LUT_DATA        <=      9'h141;
161
        LCD_LINE2+11:   LUT_DATA        <=      9'h120;
162
        LCD_LINE2+12:   LUT_DATA        <=      9'h142;
163
        LCD_LINE2+13:   LUT_DATA        <=      9'h16F;
164
        LCD_LINE2+14:   LUT_DATA        <=      9'h172;
165
        LCD_LINE2+15:   LUT_DATA        <=      9'h164;
166
        default:                LUT_DATA        <=  9'h120;
167
        endcase
168
 
169
3'b001:
170
        case(LUT_INDEX)
171
        //      Initial
172
        LCD_INTIAL+0:    LUT_DATA        <=      9'h038;
173
        LCD_INTIAL+1:   LUT_DATA        <=      9'h00C;
174
        LCD_INTIAL+2:   LUT_DATA        <=      9'h001;
175
        LCD_INTIAL+3:   LUT_DATA        <=      9'h006;
176
        LCD_INTIAL+4:   LUT_DATA        <=      9'h080;
177
        //      Line 1
178
        LCD_LINE1+0:     LUT_DATA        <=      9'h153; //      STATE: INIT
179
        LCD_LINE1+1:    LUT_DATA        <=      9'h154;
180
        LCD_LINE1+2:    LUT_DATA        <=      9'h141;
181
        LCD_LINE1+3:    LUT_DATA        <=      9'h154;
182
        LCD_LINE1+4:    LUT_DATA        <=      9'h145;
183
        LCD_LINE1+5:    LUT_DATA        <=      9'h13A;
184
        LCD_LINE1+6:    LUT_DATA        <=      9'h120;
185
        LCD_LINE1+7:    LUT_DATA        <=      9'h149;
186
        LCD_LINE1+8:    LUT_DATA        <=      9'h14E;
187
        LCD_LINE1+9:    LUT_DATA        <=      9'h149;
188
        LCD_LINE1+10:   LUT_DATA        <=      9'h154;
189
        LCD_LINE1+11:   LUT_DATA        <=      9'h120;
190
        LCD_LINE1+12:   LUT_DATA        <=      9'h120;
191
        LCD_LINE1+13:   LUT_DATA        <=      9'h120;
192
        LCD_LINE1+14:   LUT_DATA        <=      9'h120;
193
        LCD_LINE1+15:   LUT_DATA        <=      9'h120;
194
        //      Change Line
195
        LCD_CH_LINE:    LUT_DATA        <=      9'h0C0;
196
        default:                LUT_DATA        <=  9'h120;
197
        endcase
198
3'b010:
199
        case(LUT_INDEX)
200
        //      Initial
201
        LCD_INTIAL+0:    LUT_DATA        <=      9'h038;
202
        LCD_INTIAL+1:   LUT_DATA        <=      9'h00C;
203
        LCD_INTIAL+2:   LUT_DATA        <=      9'h001;
204
        LCD_INTIAL+3:   LUT_DATA        <=      9'h006;
205
        LCD_INTIAL+4:   LUT_DATA        <=      9'h080;
206
        //      Line 1
207
        LCD_LINE1+0:     LUT_DATA        <=      9'h153; //      STATE: CONFIG
208
        LCD_LINE1+1:    LUT_DATA        <=      9'h154;
209
        LCD_LINE1+2:    LUT_DATA        <=      9'h141;
210
        LCD_LINE1+3:    LUT_DATA        <=      9'h154;
211
        LCD_LINE1+4:    LUT_DATA        <=      9'h145;
212
        LCD_LINE1+5:    LUT_DATA        <=      9'h13A;
213
        LCD_LINE1+6:    LUT_DATA        <=      9'h120;
214
        LCD_LINE1+7:    LUT_DATA        <=      9'h143;
215
        LCD_LINE1+8:    LUT_DATA        <=      9'h14F;
216
        LCD_LINE1+9:    LUT_DATA        <=      9'h14E;
217
        LCD_LINE1+10:   LUT_DATA        <=      9'h146;
218
        LCD_LINE1+11:   LUT_DATA        <=      9'h149;
219
        LCD_LINE1+12:   LUT_DATA        <=      9'h147;
220
        LCD_LINE1+13:   LUT_DATA        <=      9'h120;
221
        LCD_LINE1+14:   LUT_DATA        <=      9'h120;
222
        LCD_LINE1+15:   LUT_DATA        <=      9'h120;
223
        //      Change Line
224
        LCD_CH_LINE:    LUT_DATA        <=      9'h0C0;
225
        default:                LUT_DATA        <=  9'h120;
226
        endcase
227
3'b011:
228
        case(LUT_INDEX)
229
        //      Initial
230
        LCD_INTIAL+0:    LUT_DATA        <=      9'h038;
231
        LCD_INTIAL+1:   LUT_DATA        <=      9'h00C;
232
        LCD_INTIAL+2:   LUT_DATA        <=      9'h001;
233
        LCD_INTIAL+3:   LUT_DATA        <=      9'h006;
234
        LCD_INTIAL+4:   LUT_DATA        <=      9'h080;
235
        //      Line 1
236
        LCD_LINE1+0:     LUT_DATA        <=      9'h153; // STATE: RUNNING
237
        LCD_LINE1+1:    LUT_DATA        <=      9'h154;
238
        LCD_LINE1+2:    LUT_DATA        <=      9'h141;
239
        LCD_LINE1+3:    LUT_DATA        <=      9'h154;
240
        LCD_LINE1+4:    LUT_DATA        <=      9'h145;
241
        LCD_LINE1+5:    LUT_DATA        <=      9'h13A;
242
        LCD_LINE1+6:    LUT_DATA        <=      9'h120;
243
        LCD_LINE1+7:    LUT_DATA        <=      9'h152;
244
        LCD_LINE1+8:    LUT_DATA        <=      9'h155;
245
        LCD_LINE1+9:    LUT_DATA        <=      9'h14E;
246
        LCD_LINE1+10:   LUT_DATA        <=      9'h14E;
247
        LCD_LINE1+11:   LUT_DATA        <=      9'h149;
248
        LCD_LINE1+12:   LUT_DATA        <=      9'h14E;
249
        LCD_LINE1+13:   LUT_DATA        <=      9'h147;
250
        LCD_LINE1+14:   LUT_DATA        <=      9'h120;
251
        LCD_LINE1+15:   LUT_DATA        <=      9'h120;
252
        //      Change Line
253
        LCD_CH_LINE:    LUT_DATA        <=      9'h0C0;
254
        default:                LUT_DATA        <=  9'h120;
255
        endcase
256
3'b111:
257
        case(LUT_INDEX)
258
        //      Initial
259
        LCD_INTIAL+0:    LUT_DATA        <=      9'h038;
260
        LCD_INTIAL+1:   LUT_DATA        <=      9'h00C;
261
        LCD_INTIAL+2:   LUT_DATA        <=      9'h001;
262
        LCD_INTIAL+3:   LUT_DATA        <=      9'h006;
263
        LCD_INTIAL+4:   LUT_DATA        <=      9'h080;
264
        //      Line 1
265
        LCD_LINE1+0:     LUT_DATA        <=      9'h153; // STATE: CONNECTING
266
        LCD_LINE1+1:    LUT_DATA        <=      9'h154;
267
        LCD_LINE1+2:    LUT_DATA        <=      9'h141;
268
        LCD_LINE1+3:    LUT_DATA        <=      9'h154;
269
        LCD_LINE1+4:    LUT_DATA        <=      9'h145;
270
        LCD_LINE1+5:    LUT_DATA        <=      9'h13A;
271
        LCD_LINE1+6:    LUT_DATA        <=      9'h120;
272
        LCD_LINE1+7:    LUT_DATA        <=      9'h143;
273
        LCD_LINE1+8:    LUT_DATA        <=      9'h14F;
274
        LCD_LINE1+9:    LUT_DATA        <=      9'h14E;
275
        LCD_LINE1+10:   LUT_DATA        <=      9'h14E;
276
        LCD_LINE1+11:   LUT_DATA        <=      9'h145;
277
        LCD_LINE1+12:   LUT_DATA        <=      9'h143;
278
        LCD_LINE1+13:   LUT_DATA        <=      9'h154;
279
        LCD_LINE1+14:   LUT_DATA        <=      9'h149;
280
        LCD_LINE1+15:   LUT_DATA        <=      9'h14E;
281
        //      Change Line
282
        LCD_CH_LINE:    LUT_DATA        <=      9'h0C0;
283
        default:                LUT_DATA        <=  9'h120;
284
        endcase
285
default:
286
        case(LUT_INDEX)
287
        //      Initial
288
        LCD_INTIAL+0:    LUT_DATA        <=      9'h038;
289
        LCD_INTIAL+1:   LUT_DATA        <=      9'h00C;
290
        LCD_INTIAL+2:   LUT_DATA        <=      9'h001;
291
        LCD_INTIAL+3:   LUT_DATA        <=      9'h006;
292
        LCD_INTIAL+4:   LUT_DATA        <=      9'h080;
293
        //      Line 1
294
        LCD_LINE1+0:     LUT_DATA        <=      9'h153; //      STATE: ERROR
295
        LCD_LINE1+1:    LUT_DATA        <=      9'h154;
296
        LCD_LINE1+2:    LUT_DATA        <=      9'h141;
297
        LCD_LINE1+3:    LUT_DATA        <=      9'h154;
298
        LCD_LINE1+4:    LUT_DATA        <=      9'h145;
299
        LCD_LINE1+5:    LUT_DATA        <=      9'h13A;
300
        LCD_LINE1+6:    LUT_DATA        <=      9'h120;
301
        LCD_LINE1+7:    LUT_DATA        <=      9'h145;
302
        LCD_LINE1+8:    LUT_DATA        <=      9'h152;
303
        LCD_LINE1+9:    LUT_DATA        <=      9'h152;
304
        LCD_LINE1+10:   LUT_DATA        <=      9'h14F;
305
        LCD_LINE1+11:   LUT_DATA        <=      9'h152;
306
        LCD_LINE1+12:   LUT_DATA        <=      9'h120;
307
        LCD_LINE1+13:   LUT_DATA        <=      9'h120;
308
        LCD_LINE1+14:   LUT_DATA        <=      9'h120;
309
        LCD_LINE1+15:   LUT_DATA        <=      9'h120;
310
        //      Change Line
311
        LCD_CH_LINE:    LUT_DATA        <=      9'h0C0;
312
//      //      Line 2
313
        default:                LUT_DATA        <=  9'h120;
314
        endcase
315
 
316
 
317
endcase
318
 
319
 
320
end
321
 
322
LCD_Controller          u0      (       //      Host Side
323
                                                        .iDATA(mLCD_DATA),
324
                                                        .iRS(mLCD_RS),
325
                                                        .iStart(mLCD_Start),
326
                                                        .oDone(mLCD_Done),
327
                                                        .iCLK(iCLK),
328
                                                        .iRST_N(iRST_N),
329
                                                        //      LCD Interface
330
                                                        .LCD_DATA(LCD_DATA),
331
                                                        .LCD_RW(LCD_RW),
332
                                                        .LCD_EN(LCD_EN),
333
                                                        .LCD_RS(LCD_RS) );
334
 
335
endmodule

powered by: WebSVN 2.1.0

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