OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [ip/] [Display/] [lcd_2x16.IP] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 alirezamon
#######################################################################
2
##      File: lcd_2x16.IP
3
##
4 48 alirezamon
##      Copyright (C) 2014-2019  Alireza Monemi
5 25 alirezamon
##
6 48 alirezamon
##      This file is part of ProNoC 1.9.1
7 25 alirezamon
##
8
##      WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT
9
##      MAY CAUSE UNEXPECTED BEHAIVOR.
10
################################################################################
11
 
12 38 alirezamon
$ipgen = bless( {
13 48 alirezamon
                  'ports_order' => [
14
                                     'clk',
15
                                     'reset',
16
                                     's_dat_i',
17
                                     's_addr_i',
18
                                     's_stb_i',
19
                                     's_cyc_i',
20
                                     's_we_i',
21
                                     's_dat_o',
22
                                     's_ack_o',
23
                                     'lcd_en',
24
                                     'lcd_rs',
25
                                     'lcd_rw',
26
                                     'lcd_data'
27
                                   ],
28
                  'gui_status' => {
29
                                    'status' => 'ideal',
30
                                    'timeout' => 0
31
                                  },
32
                  'description' => '2x16 Character Alphabet Liquid Crystal Display (LCD) driver module  ',
33
                  'sw_files' => [],
34
                  'modules' => {
35
                                 'lcd_2x16' => {}
36
                               },
37
                  'plugs' => {
38
                               'wb_slave' => {
39
                                               'value' => 1,
40
                                               '0' => {
41
                                                        'name' => 'wb',
42
                                                        'width' => 5,
43
                                                        'addr' => '0x9100_0000  0x91ff_ffff             General-Purpose I/O'
44
                                                      },
45
                                               'type' => 'num',
46
                                               'wb_slave' => {}
47
                                             },
48
                               'clk' => {
49
                                          'clk' => {},
50
                                          'value' => 1,
51
                                          'type' => 'num',
52
                                          '0' => {
53
                                                   'name' => 'clk'
54
                                                 }
55
                                        },
56
                               'reset' => {
57
                                            '0' => {
58
                                                     'name' => 'reset'
59
                                                   },
60
                                            'type' => 'num',
61
                                            'reset' => {},
62
                                            'value' => 1
63
                                          }
64
                             },
65
                  'system_h' => '#define                ${IP}_WR_CMD   (*((volatile unsigned int *) ($BASE)))
66
#define         ${IP}_RD_CMD    (*((volatile unsigned int *) ($BASE+4)))
67
#define         ${IP}_WR_DATA  (*((volatile unsigned int *) ($BASE+8)))
68
#define                 ${IP}_RD_DATA   (*((volatile unsigned int *) ($BASE+16)))
69
#define         ${IP}_CLK_MHZ    $CLK_MHZ
70
#define         ${IP}_WAIT_CNT          (${IP}_CLK_MHZ*100)
71
#define         ${IP}_COLUMN_NUM                16
72
#define         ${IP}_ROW_NUM           2
73 25 alirezamon
 
74 48 alirezamon
const char base_y[4]={0x80,0xc0,${IP}_COLUMN_NUM+0x80,${IP}_COLUMN_NUM+0xc0};
75 25 alirezamon
 
76 48 alirezamon
#define         ${IP}_set_8_bit_1_line()                ${IP}_wr_cmd_func(0x30)
77
#define         ${IP}_set_8_bit_2_line()                ${IP}_wr_cmd_func(0x38)
78
#define         ${IP}_set_4_bit_1_line()                ${IP}_wr_cmd_func(0x20)
79
#define         ${IP}_set_4_bit_3_line()                ${IP}_wr_cmd_func(0x28)
80
#define         ${IP}_entry_mode()              ${IP}_wr_cmd_func(0x06)
81
 
82
//(clearing display without clearing ddram content)
83
#define         ${IP}_dsply_off_cursor_off()    ${IP}_wr_cmd_func(0x08)
84
#define         ${IP}_dsply_on_cursor_on()      ${IP}_wr_cmd_func(0x0e)
85
#define         ${IP}_dsply_on_cursor_off()     ${IP}_wr_cmd_func(0x0c)
86
#define         ${IP}_dsply_on_cursor_blink()   ${IP}_wr_cmd_func(0x0f)
87
#define         ${IP}_shift_dsply_left()                ${IP}_wr_cmd_func(0x18)
88
#define         ${IP}_shift_dsply_right()               ${IP}_wr_cmd_func(0x1c)
89
#define         ${IP}_shift_cursor_left()       ${IP}_wr_cmd_func(0x10)
90
#define         ${IP}_shift_cursor_right()      ${IP}_wr_cmd_func(0x14)
91
 
92
//(also clear ddram content)
93
#define         ${IP}_clr_dsply()                       ${IP}_wr_cmd_func(0x01)
94
#define         ${IP}_goto_line(line_num)               ${IP}_wr_cmd_func(base_y[line_num-1])    // 1<= lines num <= ${IP}_ROW_NUM
95
#define         ${IP}_gotoxy(x,y)               ${IP}_wr_cmd_func(base_y[y]+x)// 0<= x< ${IP}_COLUMN_NUM;   0<= y < ${IP}_ROW_NUM
96
#define         ${IP}_show_character(c)         ${IP}_wr_data_func(c);
97
 
98
 
99
void ${IP}_wait(unsigned int volatile num);
100
 
101
static inline void ${IP}_wr_cmd_func( char data){
102
        ${IP}_WR_CMD= data;
103
        ${IP}_wait(${IP}_WAIT_CNT);
104
}
105
 
106
static inline void ${IP}_wr_data_func( char data){
107
        ${IP}_WR_DATA=data;
108
        ${IP}_wait(${IP}_WAIT_CNT);
109
}
110
 
111
void ${IP}_init(void);
112
void ${IP}_show_text(char* Text, unsigned char length);
113
',
114 38 alirezamon
                  'parameters_order' => [
115
                                          'Dw',
116
                                          'Aw',
117
                                          'CLK_MHZ'
118
                                        ],
119 48 alirezamon
                  'category' => 'Display',
120 38 alirezamon
                  'ports' => {
121
                               'lcd_rw' => {
122 48 alirezamon
                                             'intfc_port' => 'IO',
123 38 alirezamon
                                             'intfc_name' => 'IO',
124
                                             'range' => '',
125 48 alirezamon
                                             'type' => 'output'
126 25 alirezamon
                                           },
127 38 alirezamon
                               'lcd_en' => {
128 48 alirezamon
                                             'type' => 'output',
129
                                             'range' => '',
130 38 alirezamon
                                             'intfc_name' => 'IO',
131 48 alirezamon
                                             'intfc_port' => 'IO'
132 38 alirezamon
                                           },
133 48 alirezamon
                               's_dat_i' => {
134 38 alirezamon
                                              'range' => 'Dw-1       :   0',
135
                                              'intfc_name' => 'plug:wb_slave[0]',
136 48 alirezamon
                                              'type' => 'input',
137
                                              'intfc_port' => 'dat_i'
138 38 alirezamon
                                            },
139 48 alirezamon
                               's_cyc_i' => {
140
                                              'intfc_port' => 'cyc_i',
141
                                              'intfc_name' => 'plug:wb_slave[0]',
142 38 alirezamon
                                              'range' => '',
143 48 alirezamon
                                              'type' => 'input'
144 38 alirezamon
                                            },
145 48 alirezamon
                               'reset' => {
146
                                            'intfc_port' => 'reset_i',
147
                                            'type' => 'input',
148
                                            'intfc_name' => 'plug:reset[0]',
149
                                            'range' => ''
150
                                          },
151
                               'lcd_data' => {
152
                                               'intfc_port' => 'IO',
153
                                               'intfc_name' => 'IO',
154
                                               'range' => '  7: 0',
155
                                               'type' => 'inout'
156
                                             },
157
                               's_addr_i' => {
158
                                               'type' => 'input',
159
                                               'range' => 'Aw-1       :   0',
160
                                               'intfc_name' => 'plug:wb_slave[0]',
161
                                               'intfc_port' => 'adr_i'
162
                                             },
163 38 alirezamon
                               'lcd_rs' => {
164 48 alirezamon
                                             'intfc_port' => 'IO',
165 38 alirezamon
                                             'range' => '',
166
                                             'intfc_name' => 'IO',
167
                                             'type' => 'output'
168
                                           },
169 48 alirezamon
                               's_ack_o' => {
170
                                              'intfc_port' => 'ack_o',
171 38 alirezamon
                                              'intfc_name' => 'plug:wb_slave[0]',
172 48 alirezamon
                                              'range' => '',
173
                                              'type' => 'output'
174
                                            },
175
                               'clk' => {
176
                                          'intfc_port' => 'clk_i',
177
                                          'type' => 'input',
178
                                          'intfc_name' => 'plug:clk[0]',
179
                                          'range' => ''
180
                                        },
181
                               's_dat_o' => {
182 38 alirezamon
                                              'range' => 'Dw-1       :   0',
183 48 alirezamon
                                              'intfc_name' => 'plug:wb_slave[0]',
184
                                              'type' => 'output',
185
                                              'intfc_port' => 'dat_o'
186 38 alirezamon
                                            },
187 48 alirezamon
                               's_stb_i' => {
188 38 alirezamon
                                              'type' => 'input',
189
                                              'intfc_name' => 'plug:wb_slave[0]',
190
                                              'range' => '',
191 48 alirezamon
                                              'intfc_port' => 'stb_i'
192 38 alirezamon
                                            },
193 48 alirezamon
                               's_we_i' => {
194
                                             'range' => '',
195
                                             'intfc_name' => 'plug:wb_slave[0]',
196
                                             'type' => 'input',
197
                                             'intfc_port' => 'we_i'
198
                                           }
199 38 alirezamon
                             },
200 48 alirezamon
                  'sw_params_list' => [],
201
                  'module_name' => 'lcd_2x16',
202
                  'ip_name' => 'lcd_2x16',
203
                  'file_name' => 'mpsoc/rtl/src_peripheral/display/lcd_2x16/lcd_2x16.v',
204
                  'system_c' => '
205
void ${IP}_wait(unsigned int volatile num){
206
        while (num>0){
207
                num--;
208
                asm volatile ("nop");
209
        }
210
        return;
211
}
212
 
213
 
214
void ${IP}_init(void)
215
{
216
        ${IP}_set_8_bit_2_line();
217
        ${IP}_dsply_on_cursor_off();
218
        ${IP}_clr_dsply();
219
        ${IP}_entry_mode();
220
        ${IP}_goto_line(1);
221
}
222
 
223
void ${IP}_show_text(char* Text, unsigned char length){
224
        int i;
225
        for(i=0;i
226
}
227
 
228
#ifdef ${IP}_TEST_ENABLE
229
//-------------------------------------------------------------------------
230
 
231
void ${IP}_test(){
232
        unsigned int x,y;
233
 
234
         //  Initial ${IP}
235
        ${IP}_init();
236
        // Show Text to ${IP}
237
        for(y=1;y<=${IP}_ROW_NUM;y++)  {
238
                ${IP}_goto_line(y);
239
                ${IP}_show_text((char*)test_text[y-1],16);
240
        }
241
 
242
        ${IP}_wait(1000*${IP}_WAIT_CNT);
243
        ${IP}_clr_dsply();
244
 
245
        for(y=0;y<${IP}_ROW_NUM;y++){
246
                for(x=0;x<${IP}_COLUMN_NUM;x++){
247
                        ${IP}_gotoxy(x,y);
248
                        ${IP}_show_character(test_text[y][x]);
249
                        ${IP}_wait(500*${IP}_WAIT_CNT);
250
                }
251
        }
252
}
253
 
254
#endif',
255
                  'hdl_files' => [
256
                                   '/mpsoc/rtl/src_peripheral/display/lcd_2x16/lcd_2x16.v'
257
                                 ],
258 38 alirezamon
                  'parameters' => {
259 48 alirezamon
                                    'Dw' => {
260
                                              'default' => '    8',
261
                                              'content' => '',
262
                                              'global_param' => 0,
263
                                              'redefine_param' => 1,
264
                                              'info' => undef,
265
                                              'type' => 'Fixed'
266
                                            },
267 38 alirezamon
                                    'CLK_MHZ' => {
268 48 alirezamon
                                                   'default' => '100',
269 38 alirezamon
                                                   'content' => '2,1000,2',
270
                                                   'redefine_param' => 1,
271
                                                   'global_param' => 0,
272 48 alirezamon
                                                   'info' => 'The LCD controller clock speed in MHZ. It will be used for measuring the lcd enable delay. You can define a larger value than the actual clk speed but not smaller.',
273
                                                   'type' => 'Spin-button'
274 38 alirezamon
                                                 },
275
                                    'Aw' => {
276 48 alirezamon
                                              'content' => '',
277
                                              'redefine_param' => 1,
278 38 alirezamon
                                              'global_param' => 0,
279
                                              'default' => ' 2',
280
                                              'type' => 'Fixed',
281 48 alirezamon
                                              'info' => undef
282 38 alirezamon
                                            }
283
                                  },
284 48 alirezamon
                  'version' => 3,
285
                  'unused' => {
286
                                'plug:wb_slave[0]' => [
287
                                                        'cti_i',
288
                                                        'rty_o',
289
                                                        'tag_i',
290
                                                        'err_o',
291
                                                        'bte_i',
292
                                                        'sel_i'
293
                                                      ]
294
                              },
295
                  'gen_sw_files' => [
296
                                      'frename_sep_t'
297
                                    ]
298 38 alirezamon
                }, 'ip_gen' );

powered by: WebSVN 2.1.0

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