#######################################################################
|
#######################################################################
|
## File: lcd_2x16.IP
|
## File: lcd_2x16.IP
|
##
|
##
|
## Copyright (C) 2014-2016 Alireza Monemi
|
## Copyright (C) 2014-2019 Alireza Monemi
|
##
|
##
|
## This file is part of ProNoC 1.8.0
|
## This file is part of ProNoC 1.9.1
|
##
|
##
|
## WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT
|
## WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT
|
## MAY CAUSE UNEXPECTED BEHAIVOR.
|
## MAY CAUSE UNEXPECTED BEHAIVOR.
|
################################################################################
|
################################################################################
|
|
|
$ipgen = bless( {
|
$ipgen = bless( {
|
'sw_params_list' => [],
|
'ports_order' => [
|
|
'clk',
|
|
'reset',
|
|
's_dat_i',
|
|
's_addr_i',
|
|
's_stb_i',
|
|
's_cyc_i',
|
|
's_we_i',
|
|
's_dat_o',
|
|
's_ack_o',
|
|
'lcd_en',
|
|
'lcd_rs',
|
|
'lcd_rw',
|
|
'lcd_data'
|
|
],
|
|
'gui_status' => {
|
|
'status' => 'ideal',
|
|
'timeout' => 0
|
|
},
|
|
'description' => '2x16 Character Alphabet Liquid Crystal Display (LCD) driver module ',
|
|
'sw_files' => [],
|
|
'modules' => {
|
|
'lcd_2x16' => {}
|
|
},
|
|
'plugs' => {
|
|
'wb_slave' => {
|
|
'value' => 1,
|
|
'0' => {
|
|
'name' => 'wb',
|
|
'width' => 5,
|
|
'addr' => '0x9100_0000 0x91ff_ffff General-Purpose I/O'
|
|
},
|
|
'type' => 'num',
|
|
'wb_slave' => {}
|
|
},
|
|
'clk' => {
|
|
'clk' => {},
|
|
'value' => 1,
|
|
'type' => 'num',
|
|
'0' => {
|
|
'name' => 'clk'
|
|
}
|
|
},
|
|
'reset' => {
|
|
'0' => {
|
|
'name' => 'reset'
|
|
},
|
|
'type' => 'num',
|
|
'reset' => {},
|
|
'value' => 1
|
|
}
|
|
},
|
'system_h' => '#define ${IP}_WR_CMD (*((volatile unsigned int *) ($BASE)))
|
'system_h' => '#define ${IP}_WR_CMD (*((volatile unsigned int *) ($BASE)))
|
#define ${IP}_RD_CMD (*((volatile unsigned int *) ($BASE+4)))
|
#define ${IP}_RD_CMD (*((volatile unsigned int *) ($BASE+4)))
|
#define ${IP}_WR_DATA (*((volatile unsigned int *) ($BASE+8)))
|
#define ${IP}_WR_DATA (*((volatile unsigned int *) ($BASE+8)))
|
#define ${IP}_RD_DATA (*((volatile unsigned int *) ($BASE+16)))
|
#define ${IP}_RD_DATA (*((volatile unsigned int *) ($BASE+16)))
|
|
|
#define ${IP}_CLK_MHZ $CLK_MHZ
|
#define ${IP}_CLK_MHZ $CLK_MHZ
|
|
#define ${IP}_WAIT_CNT (${IP}_CLK_MHZ*100)
|
|
#define ${IP}_COLUMN_NUM 16
|
|
#define ${IP}_ROW_NUM 2
|
|
|
#include "$IP.h"',
|
const char base_y[4]={0x80,0xc0,${IP}_COLUMN_NUM+0x80,${IP}_COLUMN_NUM+0xc0};
|
|
|
|
#define ${IP}_set_8_bit_1_line() ${IP}_wr_cmd_func(0x30)
|
|
#define ${IP}_set_8_bit_2_line() ${IP}_wr_cmd_func(0x38)
|
|
#define ${IP}_set_4_bit_1_line() ${IP}_wr_cmd_func(0x20)
|
|
#define ${IP}_set_4_bit_3_line() ${IP}_wr_cmd_func(0x28)
|
|
#define ${IP}_entry_mode() ${IP}_wr_cmd_func(0x06)
|
|
|
|
//(clearing display without clearing ddram content)
|
|
#define ${IP}_dsply_off_cursor_off() ${IP}_wr_cmd_func(0x08)
|
|
#define ${IP}_dsply_on_cursor_on() ${IP}_wr_cmd_func(0x0e)
|
|
#define ${IP}_dsply_on_cursor_off() ${IP}_wr_cmd_func(0x0c)
|
|
#define ${IP}_dsply_on_cursor_blink() ${IP}_wr_cmd_func(0x0f)
|
|
#define ${IP}_shift_dsply_left() ${IP}_wr_cmd_func(0x18)
|
|
#define ${IP}_shift_dsply_right() ${IP}_wr_cmd_func(0x1c)
|
|
#define ${IP}_shift_cursor_left() ${IP}_wr_cmd_func(0x10)
|
|
#define ${IP}_shift_cursor_right() ${IP}_wr_cmd_func(0x14)
|
|
|
|
//(also clear ddram content)
|
|
#define ${IP}_clr_dsply() ${IP}_wr_cmd_func(0x01)
|
|
#define ${IP}_goto_line(line_num) ${IP}_wr_cmd_func(base_y[line_num-1]) // 1<= lines num <= ${IP}_ROW_NUM
|
|
#define ${IP}_gotoxy(x,y) ${IP}_wr_cmd_func(base_y[y]+x)// 0<= x< ${IP}_COLUMN_NUM; 0<= y < ${IP}_ROW_NUM
|
|
#define ${IP}_show_character(c) ${IP}_wr_data_func(c);
|
|
|
|
|
|
void ${IP}_wait(unsigned int volatile num);
|
|
|
|
static inline void ${IP}_wr_cmd_func( char data){
|
|
${IP}_WR_CMD= data;
|
|
${IP}_wait(${IP}_WAIT_CNT);
|
|
}
|
|
|
|
static inline void ${IP}_wr_data_func( char data){
|
|
${IP}_WR_DATA=data;
|
|
${IP}_wait(${IP}_WAIT_CNT);
|
|
}
|
|
|
|
void ${IP}_init(void);
|
|
void ${IP}_show_text(char* Text, unsigned char length);
|
|
',
|
'parameters_order' => [
|
'parameters_order' => [
|
'Dw',
|
'Dw',
|
'Aw',
|
'Aw',
|
'CLK_MHZ'
|
'CLK_MHZ'
|
],
|
],
|
'module_name' => 'lcd_2x16',
|
'category' => 'Display',
|
'gui_status' => {
|
|
'timeout' => 0,
|
|
'status' => 'ideal'
|
|
},
|
|
'ip_name' => 'lcd_2x16',
|
|
'ports' => {
|
'ports' => {
|
'lcd_rw' => {
|
'lcd_rw' => {
|
'type' => 'output',
|
'intfc_port' => 'IO',
|
'intfc_name' => 'IO',
|
'intfc_name' => 'IO',
|
'range' => '',
|
'range' => '',
|
'intfc_port' => 'IO'
|
'type' => 'output'
|
},
|
},
|
'lcd_en' => {
|
'lcd_en' => {
|
'intfc_name' => 'IO',
|
'type' => 'output',
|
'range' => '',
|
'range' => '',
|
'intfc_port' => 'IO',
|
'intfc_name' => 'IO',
|
'type' => 'output'
|
'intfc_port' => 'IO'
|
},
|
},
|
's_we_i' => {
|
's_dat_i' => {
|
|
'range' => 'Dw-1 : 0',
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'type' => 'input',
|
'type' => 'input',
|
'intfc_port' => 'we_i',
|
'intfc_port' => 'dat_i'
|
'range' => '',
|
|
'intfc_name' => 'plug:wb_slave[0]'
|
|
},
|
},
|
's_dat_o' => {
|
's_cyc_i' => {
|
'type' => 'output',
|
'intfc_port' => 'cyc_i',
|
'range' => 'Dw-1 : 0',
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_port' => 'dat_o'
|
'range' => '',
|
|
'type' => 'input'
|
},
|
},
|
'clk' => {
|
'reset' => {
|
|
'intfc_port' => 'reset_i',
|
'type' => 'input',
|
'type' => 'input',
|
'intfc_name' => 'plug:clk[0]',
|
'intfc_name' => 'plug:reset[0]',
|
'range' => '',
|
'range' => ''
|
'intfc_port' => 'clk_i'
|
|
},
|
},
|
's_ack_o' => {
|
'lcd_data' => {
|
'type' => 'output',
|
'intfc_port' => 'IO',
|
'intfc_port' => 'ack_o',
|
'intfc_name' => 'IO',
|
'range' => '',
|
'range' => ' 7: 0',
|
'intfc_name' => 'plug:wb_slave[0]'
|
'type' => 'inout'
|
},
|
},
|
's_stb_i' => {
|
's_addr_i' => {
|
'type' => 'input',
|
'type' => 'input',
|
'range' => '',
|
'range' => 'Aw-1 : 0',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_port' => 'stb_i'
|
'intfc_port' => 'adr_i'
|
},
|
},
|
'lcd_rs' => {
|
'lcd_rs' => {
|
|
'intfc_port' => 'IO',
|
'range' => '',
|
'range' => '',
|
'intfc_name' => 'IO',
|
'intfc_name' => 'IO',
|
'intfc_port' => 'IO',
|
|
'type' => 'output'
|
'type' => 'output'
|
},
|
},
|
'reset' => {
|
's_ack_o' => {
|
'intfc_port' => 'reset_i',
|
'intfc_port' => 'ack_o',
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => '',
|
'range' => '',
|
'intfc_name' => 'plug:reset[0]',
|
'type' => 'output'
|
'type' => 'input'
|
|
},
|
},
|
's_dat_i' => {
|
'clk' => {
|
|
'intfc_port' => 'clk_i',
|
'type' => 'input',
|
'type' => 'input',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:clk[0]',
|
|
'range' => ''
|
|
},
|
|
's_dat_o' => {
|
'range' => 'Dw-1 : 0',
|
'range' => 'Dw-1 : 0',
|
'intfc_port' => 'dat_i'
|
'intfc_name' => 'plug:wb_slave[0]',
|
|
'type' => 'output',
|
|
'intfc_port' => 'dat_o'
|
},
|
},
|
's_cyc_i' => {
|
's_stb_i' => {
|
'type' => 'input',
|
'type' => 'input',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => '',
|
'range' => '',
|
'intfc_port' => 'cyc_i'
|
'intfc_port' => 'stb_i'
|
},
|
},
|
's_addr_i' => {
|
's_we_i' => {
|
|
'range' => '',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => 'Aw-1 : 0',
|
'type' => 'input',
|
'intfc_port' => 'adr_i',
|
'intfc_port' => 'we_i'
|
'type' => 'input'
|
|
},
|
|
'lcd_data' => {
|
|
'range' => ' 7: 0',
|
|
'intfc_name' => 'IO',
|
|
'intfc_port' => 'IO',
|
|
'type' => 'inout'
|
|
}
|
}
|
},
|
},
|
'ports_order' => [
|
'sw_params_list' => [],
|
'clk',
|
'module_name' => 'lcd_2x16',
|
'reset',
|
'ip_name' => 'lcd_2x16',
|
's_dat_i',
|
'file_name' => 'mpsoc/rtl/src_peripheral/display/lcd_2x16/lcd_2x16.v',
|
's_addr_i',
|
'system_c' => '
|
's_stb_i',
|
void ${IP}_wait(unsigned int volatile num){
|
's_cyc_i',
|
while (num>0){
|
's_we_i',
|
num--;
|
's_dat_o',
|
asm volatile ("nop");
|
's_ack_o',
|
|
'lcd_en',
|
|
'lcd_rs',
|
|
'lcd_rw',
|
|
'lcd_data'
|
|
],
|
|
'version' => 1,
|
|
'gen_sw_files' => [
|
|
'/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16frename_sep_t${IP}.h'
|
|
],
|
|
'file_name' => '/home/alireza/Mywork/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.v',
|
|
'unused' => {
|
|
'plug:wb_slave[0]' => [
|
|
'sel_i',
|
|
'tag_i',
|
|
'bte_i',
|
|
'err_o',
|
|
'rty_o',
|
|
'cti_i'
|
|
]
|
|
},
|
|
'plugs' => {
|
|
'clk' => {
|
|
'0' => {
|
|
'name' => 'clk'
|
|
},
|
|
'type' => 'num',
|
|
'value' => 1,
|
|
'clk' => {}
|
|
},
|
|
'wb_slave' => {
|
|
'type' => 'num',
|
|
'0' => {
|
|
'addr' => '0x9100_0000 0x91ff_ffff General-Purpose I/O',
|
|
'name' => 'wb',
|
|
'width' => 5
|
|
},
|
|
'value' => 1,
|
|
'wb_slave' => {}
|
|
},
|
|
'reset' => {
|
|
'type' => 'num',
|
|
'reset' => {},
|
|
'0' => {
|
|
'name' => 'reset'
|
|
},
|
|
'value' => 1
|
|
}
|
}
|
},
|
return;
|
'modules' => {
|
}
|
'lcd_2x16' => {}
|
|
},
|
|
'category' => 'Display',
|
void ${IP}_init(void)
|
'description' => '2x16 Character Alphabet Liquid Crystal Display (LCD) driver module ',
|
{
|
|
${IP}_set_8_bit_2_line();
|
|
${IP}_dsply_on_cursor_off();
|
|
${IP}_clr_dsply();
|
|
${IP}_entry_mode();
|
|
${IP}_goto_line(1);
|
|
}
|
|
|
|
void ${IP}_show_text(char* Text, unsigned char length){
|
|
int i;
|
|
for(i=0;i
|
|
}
|
|
|
|
#ifdef ${IP}_TEST_ENABLE
|
|
//-------------------------------------------------------------------------
|
|
|
|
void ${IP}_test(){
|
|
unsigned int x,y;
|
|
|
|
// Initial ${IP}
|
|
${IP}_init();
|
|
// Show Text to ${IP}
|
|
for(y=1;y<=${IP}_ROW_NUM;y++) {
|
|
${IP}_goto_line(y);
|
|
${IP}_show_text((char*)test_text[y-1],16);
|
|
}
|
|
|
|
${IP}_wait(1000*${IP}_WAIT_CNT);
|
|
${IP}_clr_dsply();
|
|
|
|
for(y=0;y<${IP}_ROW_NUM;y++){
|
|
for(x=0;x<${IP}_COLUMN_NUM;x++){
|
|
${IP}_gotoxy(x,y);
|
|
${IP}_show_character(test_text[y][x]);
|
|
${IP}_wait(500*${IP}_WAIT_CNT);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif',
|
|
'hdl_files' => [
|
|
'/mpsoc/rtl/src_peripheral/display/lcd_2x16/lcd_2x16.v'
|
|
],
|
'parameters' => {
|
'parameters' => {
|
|
'Dw' => {
|
|
'default' => ' 8',
|
|
'content' => '',
|
|
'global_param' => 0,
|
|
'redefine_param' => 1,
|
|
'info' => undef,
|
|
'type' => 'Fixed'
|
|
},
|
'CLK_MHZ' => {
|
'CLK_MHZ' => {
|
|
'default' => '100',
|
'content' => '2,1000,2',
|
'content' => '2,1000,2',
|
'redefine_param' => 1,
|
'redefine_param' => 1,
|
'type' => 'Spin-button',
|
|
'global_param' => 0,
|
'global_param' => 0,
|
'default' => '100',
|
'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.',
|
'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.'
|
'type' => 'Spin-button'
|
},
|
},
|
'Aw' => {
|
'Aw' => {
|
'global_param' => 0,
|
|
'default' => ' 2',
|
|
'info' => undef,
|
|
'content' => '',
|
'content' => '',
|
'redefine_param' => 1,
|
'redefine_param' => 1,
|
'type' => 'Fixed'
|
'global_param' => 0,
|
},
|
'default' => ' 2',
|
'Dw' => {
|
|
'type' => 'Fixed',
|
'type' => 'Fixed',
|
'redefine_param' => 1,
|
'info' => undef
|
'content' => '',
|
|
'info' => undef,
|
|
'default' => ' 8',
|
|
'global_param' => 0
|
|
}
|
}
|
},
|
},
|
'hdl_files' => [
|
'version' => 3,
|
'/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.v'
|
'unused' => {
|
],
|
'plug:wb_slave[0]' => [
|
'sw_files' => []
|
'cti_i',
|
|
'rty_o',
|
|
'tag_i',
|
|
'err_o',
|
|
'bte_i',
|
|
'sel_i'
|
|
]
|
|
},
|
|
'gen_sw_files' => [
|
|
'frename_sep_t'
|
|
]
|
}, 'ip_gen' );
|
}, 'ip_gen' );
|
|
|