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

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 22 to Rev 23
    Reverse comparison

Rev 22 → Rev 23

/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.v
0,0 → 1,80
// synthesis translate_off
`timescale 1ns / 1ps
// synthesis translate_on
 
 
module lcd_2x16 #(
parameter Dw = 8, // wishbone bus data width
parameter Aw = 2
)(
clk,
reset,
//wishbone bus interface
s_dat_i,
s_addr_i,
s_stb_i,
s_cyc_i,
s_we_i,
s_dat_o,
s_ack_o,
//lcd interface
lcd_en,
lcd_rs,
lcd_rw,
lcd_data
);
 
 
 
input clk;
input reset;
//wishbone bus interface
input [Dw-1 : 0] s_dat_i;
input [Aw-1 : 0] s_addr_i;
input s_stb_i;
input s_cyc_i;
input s_we_i;
output [Dw-1 : 0] s_dat_o;
output reg s_ack_o;
 
 
output lcd_en;
output lcd_rs;
output lcd_rw;
inout [ 7: 0] lcd_data;
reg [5:0]cnt;
 
assign lcd_rw = s_addr_i[0];
assign lcd_rs = s_addr_i[1];
 
 
assign lcd_en = (cnt>0);
assign lcd_data = (s_addr_i[0]) ? 8'bz : s_dat_i;
assign s_dat_o = lcd_data;
 
always @(posedge clk or posedge reset) begin
if(reset) begin
s_ack_o <= 1'b0;
cnt=6'd0;
end else begin
s_ack_o <= s_stb_i & (cnt==2);
if(s_stb_i && cnt==0) cnt=6'h111111;
else if(lcd_en)cnt=cnt-1'b1;
end
end
 
endmodule
 
 
 
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.h
0,0 → 1,84
#ifndef LCD_H
#define LCD_H
 
#define lcd_set_8_bit_1_line() lcd_wr_cmd_func(0x30)
#define lcd_set_8_bit_2_line() lcd_wr_cmd_func(0x38)
#define lcd_set_4_bit_1_line() lcd_wr_cmd_func(0x20)
#define lcd_set_4_bit_3_line() lcd_wr_cmd_func(0x28)
#define lcd_entry_mode() lcd_wr_cmd_func(0x06)
//(clearing display without clearing ddram content)
#define lcd_dsply_off_cursor_off() lcd_wr_cmd_func(0x08)
#define lcd_dsply_on_cursor_on() lcd_wr_cmd_func(0x0e)
#define lcd_dsply_on_cursor_off() lcd_wr_cmd_func(0x0c)
#define lcd_dsply_on_cursor_blink() lcd_wr_cmd_func(0x0f)
#define lcd_shift_dsply_left() lcd_wr_cmd_func(0x18)
#define lcd_shift_dsply_right() lcd_wr_cmd_func(0x1c)
#define lcd_shift_cursor_left() lcd_wr_cmd_func(0x10)
#define lcd_shift_cursor_right() lcd_wr_cmd_func(0x14)
//(also clear ddram content)
#define lcd_clr_dsply() lcd_wr_cmd_func(0x01)
#define lcd_line1() lcd_wr_cmd_func(0x80) //< address offset for 1st line in 2-line display mode
#define lcd_line2() lcd_wr_cmd_func(0xc0) ///< address offset for 2nd line in 2-line display mode
 
 
 
void lcd_wait(){
unsigned int volatile num=20000;
while (num>0){
num--;
asm volatile ("nop");
}
return;
}
 
 
inline void lcd_wr_cmd_func( char data){
LCD_WR_CMD= data;
lcd_wait();
}
 
inline void lcd_wr_data_func( char data){
LCD_WR_DATA=data;
lcd_wait();
}
 
 
 
 
 
 
void lcd_init()
{
lcd_set_8_bit_2_line();
lcd_dsply_on_cursor_off();
lcd_clr_dsply();
lcd_entry_mode();
lcd_line1();
}
 
//-------------------------------------------------------------------------
void lcd_show_text(char* Text, unsigned char length)
{
int i;
for(i=0;i<length;i++) lcd_wr_data_func(Text[i]);
}
 
 
//-------------------------------------------------------------------------
void lcd_test()
{
char Text1[17] = "LCD 2x16 test";
char Text2[17] = " ProNoC SoC ";
// Initial LCD
lcd_init();
// Show Text to LCD
lcd_show_text(Text1,13);
// Change Line2
lcd_line2();
// Show Text to LCD
lcd_show_text(Text2,16);
}
//-------------------------------------------------------------------------
 
#endif
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/perl_gui/lib/perl/mpsoc_gen.pl
795,7 → 795,7
if($router_type eq '"VC_BASED"'){
#VC number per port
my $v=$mpsoc->mpsoc_get_param('V');
$mpsoc->mpsoc_add_param('V',2) if($v eq 1);
if(defined $v){ $mpsoc->mpsoc_add_param('V',2) if($v eq 1);}
$label='VC number per port';
$param='V';
$default='2';
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/perl_gui/lib/perl/soc_gen.pl
935,12 → 935,19
}
# Write main.c file if not exist
my $n="$target_dir/sw/main.c";
if (!(-f "$n")) {
# Write main.c
open(FILE, ">$n") || die "Can not open: $!";
print FILE main_c_template($name);
close(FILE) || die "Error closing file: $!";
}
message_dialog("SoC \"$name\" has been created successfully at $target_dir/ " );
exec($^X, $0, @ARGV);# reset ProNoC to apply changes
953,11 → 960,43
}
 
 
sub main_c_template{
my $hdr=shift;
my $text="
#include \"$hdr.h\"
 
 
// a simple delay function
void delay ( unsigned int num ){
while (num>0){
num--;
asm volatile (\"nop\");
}
return;
 
}
 
int main(){
while(1){
 
}
 
return 0;
}
 
";
 
return $text;
 
 
}
 
 
 
 
sub get_wb_address {
my ($soc,$instance_id,$addr,$width)=@_;
my ($base,$end);
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/perl_gui/lib/ip/lcd_2x16.IP
0,0 → 1,176
$lcd_2x16 = bless( {
'hdl_files' => [
'/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.v'
],
'description' => 'Alphabet Display LCD 2x16',
'ip_name' => 'lcd_2x16',
'plugs' => {
'clk' => {
'clk' => {},
'value' => 1,
'0' => {
'name' => 'clk'
},
'type' => 'num'
},
'reset' => {
'reset' => {},
'value' => 1,
'0' => {
'name' => 'reset'
},
'type' => 'num'
},
'wb_slave' => {
'value' => 1,
'0' => {
'width' => 5,
'name' => 'wb_slave',
'addr' => '0x9100_0000 0x91ff_ffff General-Purpose I/O'
},
'type' => 'num',
'wb_slave' => {}
}
},
'modules' => {
'lcd_2x16' => {}
},
'parameters' => {
'Aw' => {
'info' => undef,
'deafult' => ' 2',
'global_param' => 0,
'content' => '',
'type' => 'Fixed',
'redefine_param' => 1
},
'Dw' => {
'info' => undef,
'deafult' => ' 8',
'global_param' => 0,
'content' => '',
'type' => 'Fixed',
'redefine_param' => 1
}
},
'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'
],
'ports' => {
's_cyc_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'cyc_i',
'range' => '',
'type' => 'input'
},
's_dat_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'dat_i',
'range' => 'Dw-1 : 0',
'type' => 'input'
},
'lcd_en' => {
'intfc_name' => 'IO',
'intfc_port' => 'IO',
'range' => '',
'type' => 'output'
},
's_ack_o' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'ack_o',
'range' => '',
'type' => 'output'
},
's_we_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'we_i',
'range' => '',
'type' => 'input'
},
's_stb_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'stb_i',
'range' => '',
'type' => 'input'
},
'lcd_data' => {
'intfc_name' => 'IO',
'intfc_port' => 'IO',
'range' => ' 7: 0',
'type' => 'inout'
},
'lcd_rs' => {
'intfc_name' => 'IO',
'intfc_port' => 'IO',
'range' => '',
'type' => 'output'
},
'reset' => {
'intfc_name' => 'plug:reset[0]',
'intfc_port' => 'reset_i',
'range' => '',
'type' => 'input'
},
'lcd_rw' => {
'intfc_name' => 'IO',
'intfc_port' => 'IO',
'range' => '',
'type' => 'output'
},
'clk' => {
'intfc_name' => 'plug:clk[0]',
'intfc_port' => 'clk_i',
'range' => '',
'type' => 'input'
},
's_addr_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'adr_i',
'range' => 'Aw-1 : 0',
'type' => 'input'
},
's_dat_o' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'dat_o',
'range' => 'Dw-1 : 0',
'type' => 'output'
}
},
'parameters_order' => [
'Dw',
'Aw'
],
'file_name' => '/home/alireza/Mywork/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.v',
'module_name' => 'lcd_2x16',
'unused' => {
'plug:wb_slave[0]' => [
'err_o',
'rty_o',
'tag_i',
'cti_i',
'sel_i',
'bte_i'
]
},
'category' => 'Display',
'header' => '#define LCD_WR_CMD (*((volatile unsigned int *) ($BASE)))
#define LCD_RD_CMD (*((volatile unsigned int *) ($BASE+4)))
#define LCD_WR_DATA (*((volatile unsigned int *) ($BASE+8)))
#define LCD_RD_DATA (*((volatile unsigned int *) ($BASE+16)))
#include "lcd_2x16.h"',
'sw_files' => [
'/mpsoc/src_peripheral/display/lcd_2x16/lcd_2x16.h'
]
}, 'ip_gen' );

powered by: WebSVN 2.1.0

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