Line 1... |
Line 1... |
#######################################################################
|
#######################################################################
|
## File: timer.IP
|
## File: timer.IP
|
##
|
##
|
## Copyright (C) 2014-2016 Alireza Monemi
|
## Copyright (C) 2014-2019 Alireza Monemi
|
##
|
##
|
## This file is part of ProNoC 1.7.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.
|
################################################################################
|
################################################################################
|
|
|
$timer = bless( {
|
$ipgen = bless( {
|
'system_h' => '#define ${IP}_TCSR (*((volatile unsigned int *) ($BASE )))
|
|
|
|
/*
|
|
//timer control register
|
|
TCSR
|
|
bit
|
|
PRESCALER WIDTH+3:4 : clk_dev_ctrl
|
|
3 : timer_isr
|
|
2 : rst_on_cmp_value
|
|
1 : int_enble_on_cmp_value
|
|
0 : timer enable
|
|
*/
|
|
#define ${IP}_TLR (*((volatile unsigned int *) ($BASE+4 )))
|
|
#define ${IP}_TCMR (*((volatile unsigned int *) ($BASE+8 )))
|
|
#define ${IP}_EN (1 << 0)
|
|
#define ${IP}_INT_EN (1 << 1)
|
|
#define ${IP}_RST_ON_CMP (1 << 2)
|
|
//Initialize the timer. Enable the timer, reset on compare value, and interrupt
|
|
void ${IP}_int_init ( unsigned int compare ){
|
|
${IP}_TCMR = compare;
|
|
${IP}_TCSR = ( ${IP}_EN | ${IP}_INT_EN | ${IP}_RST_ON_CMP);
|
|
}
|
|
|
|
#define ${IP}_start() ${IP}_TCSR|=${IP}_EN
|
|
#define ${IP}_stop() ${IP}_TCSR&=~${IP}_EN
|
|
#define ${IP}_reset() ${IP}_TLR=0
|
|
#define ${IP}_read() ${IP}_TLR',
|
|
'gui_status' => {
|
|
'timeout' => 0,
|
|
'status' => 'ideal'
|
|
},
|
|
'parameters' => {
|
|
'CNTw' => {
|
|
'default' => '32 ',
|
|
'type' => 'Fixed',
|
|
'global_param' => 'Localparam',
|
|
'content' => '',
|
|
'info' => undef,
|
|
'redefine_param' => 1
|
|
},
|
|
'Dw' => {
|
|
'default' => '32',
|
|
'type' => 'Fixed',
|
|
'content' => '',
|
|
'global_param' => 'Localparam',
|
|
'info' => undef,
|
|
'redefine_param' => 1
|
|
},
|
|
'SELw' => {
|
|
'content' => '',
|
|
'global_param' => 'Localparam',
|
|
'redefine_param' => 1,
|
|
'info' => undef,
|
|
'type' => 'Fixed',
|
|
'default' => '4'
|
|
},
|
|
'TAGw' => {
|
|
'redefine_param' => 1,
|
|
'info' => undef,
|
|
'global_param' => 'Localparam',
|
|
'content' => '',
|
|
'type' => 'Fixed',
|
|
'default' => '3'
|
|
},
|
|
'PRESCALER_WIDTH' => {
|
|
'type' => 'Spin-button',
|
|
'default' => '8',
|
|
'redefine_param' => 1,
|
|
'info' => ' The prescaler timer width. The prescaler takes the basic timer clock frequency and divides it by some value before feeding it to the timer, according to how the prescaler register(s) are configured.
|
|
|
|
|
|
',
|
|
'global_param' => 'Parameter',
|
|
'content' => '1,32,1'
|
|
},
|
|
'Aw' => {
|
|
'global_param' => 'Localparam',
|
|
'content' => '',
|
|
'redefine_param' => 1,
|
|
'info' => undef,
|
|
'type' => 'Fixed',
|
|
'default' => '3'
|
|
}
|
|
},
|
|
'module_name' => 'timer',
|
|
'description' => 'A simple, general purpose, Wishbone bus-based, 32-bit timer.',
|
|
'sockets' => {},
|
|
'hdl_files' => [
|
|
'/mpsoc/src_peripheral/timer/timer.v'
|
|
],
|
|
'category' => 'Timer',
|
|
'parameters_order' => [
|
|
'CNTw',
|
|
'Dw',
|
|
'Aw',
|
|
'TAGw',
|
|
'SELw',
|
|
'PRESCALER_WIDTH'
|
|
],
|
|
'plugs' => {
|
'plugs' => {
|
'interrupt_peripheral' => {
|
'wb_slave' => {
|
|
'wb_slave' => {},
|
'type' => 'num',
|
'type' => 'num',
|
'interrupt_peripheral' => {},
|
|
'value' => 1,
|
'value' => 1,
|
'0' => {
|
'0' => {
|
'name' => 'intrp'
|
'addr' => '0x9600_0000 0x96ff_ffff PWM/Timer/Counter Ctrl',
|
|
'name' => 'wb',
|
|
'width' => 5
|
}
|
}
|
},
|
},
|
'wb_slave' => {
|
'interrupt_peripheral' => {
|
'type' => 'num',
|
'value' => 1,
|
'wb_slave' => {},
|
|
'0' => {
|
'0' => {
|
'addr' => '0x9600_0000 0x96ff_ffff PWM/Timer/Counter Ctrl',
|
'name' => 'intrp'
|
'width' => 5,
|
|
'name' => 'wb'
|
|
},
|
},
|
'value' => 1
|
'type' => 'num',
|
|
'interrupt_peripheral' => {}
|
},
|
},
|
'reset' => {
|
'reset' => {
|
'reset' => {},
|
'type' => 'num',
|
'value' => 1,
|
'value' => 1,
|
'0' => {
|
'0' => {
|
'name' => 'reset'
|
'name' => 'reset'
|
},
|
},
|
'type' => 'num'
|
'reset' => {}
|
},
|
},
|
'clk' => {
|
'clk' => {
|
'clk' => {},
|
|
'type' => 'num',
|
'type' => 'num',
|
|
'value' => 1,
|
'0' => {
|
'0' => {
|
'name' => 'clk'
|
'name' => 'clk'
|
},
|
},
|
'value' => 1
|
'clk' => {}
|
}
|
}
|
},
|
},
|
'unused' => {
|
'description' => 'A simple, general purpose, Wishbone bus-based, 32-bit timer.',
|
'plug:wb_slave[0]' => [
|
'file_name' => 'mpsoc/rtl/src_peripheral/timer/timer.v',
|
'cti_i',
|
'module_name' => 'timer',
|
'bte_i'
|
'parameters_order' => [
|
]
|
'CNTw',
|
},
|
'Dw',
|
|
'Aw',
|
|
'TAGw',
|
|
'SELw',
|
|
'PRESCALER_WIDTH'
|
|
],
|
'ports' => {
|
'ports' => {
|
'sa_we_i' => {
|
'sa_err_o' => {
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_port' => 'err_o',
|
'intfc_port' => 'we_i',
|
|
'type' => 'input',
|
|
'range' => ''
|
|
},
|
|
'sa_tag_i' => {
|
|
'intfc_port' => 'tag_i',
|
|
'range' => 'TAGw-1 : 0',
|
|
'type' => 'input',
|
|
'intfc_name' => 'plug:wb_slave[0]'
|
|
},
|
|
'sa_stb_i' => {
|
|
'range' => '',
|
'range' => '',
|
'type' => 'input',
|
|
'intfc_port' => 'stb_i',
|
|
'intfc_name' => 'plug:wb_slave[0]'
|
|
},
|
|
'sa_addr_i' => {
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_port' => 'adr_i',
|
'type' => 'output'
|
'type' => 'input',
|
|
'range' => 'Aw-1 : 0'
|
|
},
|
},
|
'irq' => {
|
'sa_rty_o' => {
|
'intfc_name' => 'plug:interrupt_peripheral[0]',
|
'intfc_port' => 'rty_o',
|
'range' => '',
|
|
'type' => 'output',
|
|
'intfc_port' => 'int_o'
|
|
},
|
|
'reset' => {
|
|
'intfc_name' => 'plug:reset[0]',
|
|
'type' => 'input',
|
|
'range' => '',
|
'range' => '',
|
'intfc_port' => 'reset_i'
|
'intfc_name' => 'plug:wb_slave[0]',
|
|
'type' => 'output'
|
},
|
},
|
'sa_err_o' => {
|
'sa_dat_o' => {
|
|
'intfc_port' => 'dat_o',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => '',
|
'range' => 'Dw-1 : 0',
|
'type' => 'output',
|
'type' => 'output'
|
'intfc_port' => 'err_o'
|
|
},
|
},
|
'sa_sel_i' => {
|
'sa_sel_i' => {
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => 'SELw-1 : 0',
|
'range' => 'SELw-1 : 0',
|
'type' => 'input',
|
|
'intfc_port' => 'sel_i',
|
'intfc_port' => 'sel_i',
|
'intfc_name' => 'plug:wb_slave[0]'
|
'type' => 'input'
|
},
|
},
|
'sa_rty_o' => {
|
'sa_we_i' => {
|
'intfc_name' => 'plug:wb_slave[0]',
|
|
'type' => 'output',
|
|
'range' => '',
|
'range' => '',
|
'intfc_port' => 'rty_o'
|
|
},
|
|
'sa_dat_i' => {
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'type' => 'input',
|
'intfc_port' => 'we_i',
|
'range' => 'Dw-1 : 0',
|
'type' => 'input'
|
'intfc_port' => 'dat_i'
|
|
},
|
},
|
'sa_cyc_i' => {
|
'sa_cyc_i' => {
|
|
'type' => 'input',
|
|
'range' => '',
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
|
'intfc_port' => 'cyc_i'
|
|
},
|
|
'irq' => {
|
|
'intfc_name' => 'plug:interrupt_peripheral[0]',
|
|
'range' => '',
|
|
'intfc_port' => 'int_o',
|
|
'type' => 'output'
|
|
},
|
|
'sa_tag_i' => {
|
|
'intfc_port' => 'tag_i',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_port' => 'cyc_i',
|
'range' => 'TAGw-1 : 0',
|
|
'type' => 'input'
|
|
},
|
|
'reset' => {
|
'type' => 'input',
|
'type' => 'input',
|
|
'intfc_port' => 'reset_i',
|
|
'intfc_name' => 'plug:reset[0]',
|
'range' => ''
|
'range' => ''
|
},
|
},
|
|
'sa_addr_i' => {
|
|
'range' => 'Aw-1 : 0',
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
|
'intfc_port' => 'adr_i',
|
|
'type' => 'input'
|
|
},
|
'clk' => {
|
'clk' => {
|
|
'type' => 'input',
|
'intfc_port' => 'clk_i',
|
'intfc_port' => 'clk_i',
|
'range' => '',
|
'range' => '',
|
'type' => 'input',
|
|
'intfc_name' => 'plug:clk[0]'
|
'intfc_name' => 'plug:clk[0]'
|
},
|
},
|
'sa_dat_o' => {
|
'sa_dat_i' => {
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => 'Dw-1 : 0',
|
'range' => 'Dw-1 : 0',
|
'type' => 'output',
|
'intfc_port' => 'dat_i',
|
'intfc_port' => 'dat_o'
|
'type' => 'input'
|
},
|
},
|
'sa_ack_o' => {
|
'sa_stb_i' => {
|
|
'range' => '',
|
'intfc_name' => 'plug:wb_slave[0]',
|
'intfc_name' => 'plug:wb_slave[0]',
|
|
'intfc_port' => 'stb_i',
|
|
'type' => 'input'
|
|
},
|
|
'sa_ack_o' => {
|
'type' => 'output',
|
'type' => 'output',
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
'range' => '',
|
'range' => '',
|
'intfc_port' => 'ack_o'
|
'intfc_port' => 'ack_o'
|
}
|
}
|
},
|
},
|
'modules' => {
|
'modules' => {
|
'timer' => {}
|
'timer' => {}
|
},
|
},
|
'version' => 9,
|
|
'ip_name' => 'timer',
|
'ip_name' => 'timer',
|
'description_pdf' => '/mpsoc/src_peripheral/timer/timer.pdf',
|
'description_pdf' => '/mpsoc/rtl/src_peripheral/timer/timer.pdf',
|
'file_name' => '/home/alireza/Mywork/mpsoc/src_peripheral/timer/timer.v'
|
'version' => 12,
|
|
'system_h' => '#define ${IP}_TCSR (*((volatile unsigned int *) ($BASE )))
|
|
|
|
/*
|
|
//timer control register
|
|
TCSR
|
|
bit
|
|
PRESCALER WIDTH+3:4 : clk_dev_ctrl
|
|
3 : timer_isr
|
|
2 : rst_on_cmp_value
|
|
1 : int_enble_on_cmp_value
|
|
0 : timer enable
|
|
*/
|
|
#define ${IP}_TLR (*((volatile unsigned int *) ($BASE+4 )))
|
|
#define ${IP}_TCMR (*((volatile unsigned int *) ($BASE+8 )))
|
|
#define ${IP}_EN (1 << 0)
|
|
#define ${IP}_INT_EN (1 << 1)
|
|
#define ${IP}_RST_ON_CMP (1 << 2)
|
|
//Initialize the timer. Enable the timer, reset on compare value, and interrupt
|
|
static inline void ${IP}_int_init ( unsigned int compare ){
|
|
${IP}_TCMR = compare;
|
|
${IP}_TCSR = ( ${IP}_EN | ${IP}_INT_EN | ${IP}_RST_ON_CMP);
|
|
}
|
|
|
|
#define ${IP}_start() ${IP}_TCSR|=${IP}_EN
|
|
#define ${IP}_stop() ${IP}_TCSR&=~${IP}_EN
|
|
#define ${IP}_reset() ${IP}_TLR=0
|
|
#define ${IP}_read() ${IP}_TLR',
|
|
'hdl_files' => [
|
|
'/mpsoc/rtl/src_peripheral/timer/timer.v'
|
|
],
|
|
'parameters' => {
|
|
'CNTw' => {
|
|
'info' => undef,
|
|
'redefine_param' => 1,
|
|
'content' => '',
|
|
'global_param' => 'Localparam',
|
|
'default' => '32 ',
|
|
'type' => 'Fixed'
|
|
},
|
|
'TAGw' => {
|
|
'global_param' => 'Localparam',
|
|
'type' => 'Fixed',
|
|
'default' => '3',
|
|
'info' => undef,
|
|
'redefine_param' => 1,
|
|
'content' => ''
|
|
},
|
|
'SELw' => {
|
|
'global_param' => 'Localparam',
|
|
'default' => '4',
|
|
'type' => 'Fixed',
|
|
'content' => '',
|
|
'info' => undef,
|
|
'redefine_param' => 1
|
|
},
|
|
'PRESCALER_WIDTH' => {
|
|
'info' => ' The prescaler timer width. The prescaler takes the basic timer clock frequency and divides it by some value before feeding it to the timer, according to how the prescaler register(s) are configured.
|
|
|
|
|
|
',
|
|
'redefine_param' => 1,
|
|
'content' => '1,32,1',
|
|
'global_param' => 'Localparam',
|
|
'type' => 'Spin-button',
|
|
'default' => '8'
|
|
},
|
|
'Aw' => {
|
|
'info' => undef,
|
|
'redefine_param' => 1,
|
|
'content' => '',
|
|
'global_param' => 'Localparam',
|
|
'type' => 'Fixed',
|
|
'default' => '3'
|
|
},
|
|
'Dw' => {
|
|
'content' => '',
|
|
'info' => undef,
|
|
'redefine_param' => 1,
|
|
'global_param' => 'Localparam',
|
|
'default' => '32',
|
|
'type' => 'Fixed'
|
|
}
|
|
},
|
|
'category' => 'Timer',
|
|
'sockets' => {},
|
|
'gui_status' => {
|
|
'timeout' => 0,
|
|
'status' => 'ideal'
|
|
},
|
|
'unused' => {
|
|
'plug:wb_slave[0]' => [
|
|
'bte_i',
|
|
'cti_i'
|
|
]
|
|
}
|
}, 'ip_gen' );
|
}, 'ip_gen' );
|