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/] [Interrupt/] [int_ctrl.IP] - Rev 48
Compare with Previous | Blame | View Log
#######################################################################
## File: int_ctrl.IP
##
## Copyright (C) 2014-2019 Alireza Monemi
##
## This file is part of ProNoC 1.9.1
##
## WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT
## MAY CAUSE UNEXPECTED BEHAVIOR.
################################################################################
$ipgen = bless( {
'version' => 6,
'system_h' => '
#define ${IP}_MER (*((volatile unsigned int *) ($BASE )))
#define ${IP}_IER (*((volatile unsigned int *) ($BASE+4 )))
#define ${IP}_IAR (*((volatile unsigned int *) ($BASE+8 )))
#define ${IP}_IPR (*((volatile unsigned int *) ($BASE+12 )))
#define ${IP}_INT_NUM ${INT_NUM}
struct ihnd {
void (*handler)(void);
void *arg;
};
/* Initialize routine */
int general_int_init (void);
/* Add interrupt handler */
int general_int_add(unsigned long irq, void (* handler)(), void *arg);
/* Disable interrupt */
int general_int_disable (unsigned long irq);
/* Enable interrupt */
int general_int_enable(unsigned long irq);
/* Main interrupt handler */
void general_int_main();
',
'hdl_files' => [
'/mpsoc/rtl/src_peripheral/int_ctrl/int_ctrl.v'
],
'ports' => {
'sa_dat_o' => {
'type' => 'output',
'range' => 'Dw-1 : 0',
'intfc_port' => 'dat_o',
'intfc_name' => 'plug:wb_slave[0]'
},
'sa_dat_i' => {
'range' => 'Dw-1 : 0',
'intfc_port' => 'dat_i',
'type' => 'input',
'intfc_name' => 'plug:wb_slave[0]'
},
'reset' => {
'intfc_port' => 'reset_i',
'range' => '',
'type' => 'input',
'intfc_name' => 'plug:reset[0]'
},
'sa_sel_i' => {
'range' => 'SELw-1 : 0',
'intfc_port' => 'sel_i',
'type' => 'input',
'intfc_name' => 'plug:wb_slave[0]'
},
'sa_err_o' => {
'range' => '',
'intfc_port' => 'err_o',
'type' => 'output',
'intfc_name' => 'plug:wb_slave[0]'
},
'sa_stb_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'type' => 'input',
'intfc_port' => 'stb_i',
'range' => ''
},
'sa_we_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'range' => '',
'intfc_port' => 'we_i',
'type' => 'input'
},
'int_o' => {
'range' => '',
'intfc_port' => 'int_o',
'type' => 'output',
'intfc_name' => 'plug:interrupt_cpu[0]'
},
'sa_ack_o' => {
'intfc_name' => 'plug:wb_slave[0]',
'intfc_port' => 'ack_o',
'range' => '',
'type' => 'output'
},
'sa_addr_i' => {
'intfc_name' => 'plug:wb_slave[0]',
'type' => 'input',
'range' => 'Aw-1 : 0',
'intfc_port' => 'adr_i'
},
'int_i' => {
'type' => 'input',
'range' => 'INT_NUM-1 : 0',
'intfc_port' => 'int_i',
'intfc_name' => 'socket:interrupt_peripheral[array]'
},
'clk' => {
'intfc_name' => 'plug:clk[0]',
'intfc_port' => 'clk_i',
'range' => '',
'type' => 'input'
},
'sa_rty_o' => {
'intfc_port' => 'rty_o',
'type' => 'output',
'range' => '',
'intfc_name' => 'plug:wb_slave[0]'
}
},
'system_c' => '/* Interrupt handlers table */
struct ihnd int_handlers[${IP}_INT_NUM ];
/* Initialize routine */
int general_int_init (void)
{
int i;
for(i = 0; i <${IP}_INT_NUM; i++) {
int_handlers[i].handler = 0;
int_handlers[i].arg = 0;
}
${IP}_IER=0;
${IP}_MER=0x3;
return 0;
}
/* Add interrupt handler */
int general_int_add(unsigned long irq, void (* handler)(void), void *arg)
{
if(irq >= ${IP}_INT_NUM) return -1;
int_handlers[irq].handler = handler;
int_handlers[irq].arg = arg;
return 0;
}
/* Disable interrupt */
int general_int_disable (unsigned long irq)
{
if(irq >=${IP}_INT_NUM) return -1;
${IP}_IER &= ~(0x00000001L << irq);
return 0;
}
/* Enable interrupt */
int general_int_enable(unsigned long irq)
{
if(irq >= ${IP}_INT_NUM) return -1;
${IP}_IER |= (0x00000001L << irq);
return 0;
}
/* Main interrupt handler */
void general_int_main()
{
unsigned long i = 0;
unsigned long ipr =${IP}_IPR;
while(i < 32) {
if((ipr & (0x01L << i)) && (int_handlers[i].handler != 0)) {
(*int_handlers[i].handler)( ); //(int_handlers[i].arg);
}
i++;
}
${IP}_IAR = ipr; // Acknowledge all Interrupts
}
',
'modules' => {
'int_ctrl' => {}
},
'gui_status' => {
'status' => 'ideal',
'timeout' => 0
},
'sockets' => {
'interrupt_peripheral' => {
'type' => 'param',
'0' => {
'name' => 'int_periph'
},
'interrupt_peripheral' => {},
'connection_num' => 'single connection',
'value' => 'INT_NUM'
}
},
'description' => 'interrupt controller',
'ip_name' => 'int_ctrl',
'module_name' => 'int_ctrl',
'category' => 'Interrupt',
'parameters' => {
'Dw' => {
'content' => '',
'default' => ' 32',
'global_param' => 'Localparam',
'type' => 'Fixed',
'redefine_param' => 1,
'info' => undef
},
'INT_NUM' => {
'content' => '1,32,1',
'default' => ' 3',
'type' => 'Spin-button',
'global_param' => 'Localparam',
'redefine_param' => 1,
'info' => 'number of inerrupt.'
},
'SELw' => {
'content' => '',
'default' => ' 4 ',
'global_param' => 'Localparam',
'type' => 'Fixed',
'redefine_param' => 1,
'info' => undef
},
'Aw' => {
'content' => '',
'info' => undef,
'redefine_param' => 1,
'type' => 'Fixed',
'global_param' => 'Localparam',
'default' => ' 3'
}
},
'unused' => {
'plug:wb_slave[0]' => [
'bte_i',
'cti_i',
'tag_i',
'cyc_i'
]
},
'file_name' => 'mpsoc/rtl/src_peripheral/int_ctrl/int_ctrl.v',
'parameters_order' => [
'INT_NUM',
'Dw',
'Aw',
'SELw'
],
'plugs' => {
'wb_slave' => {
'wb_slave' => {},
'value' => 1,
'type' => 'num',
'0' => {
'addr' => '0x9e00_0000 0x9eff_ffff IDE Controller',
'name' => 'wb',
'width' => 5
}
},
'reset' => {
'type' => 'num',
'0' => {
'name' => 'reset'
},
'reset' => {},
'value' => 1
},
'clk' => {
'value' => 1,
'type' => 'num',
'clk' => {},
'0' => {
'name' => 'clk'
}
},
'interrupt_cpu' => {
'value' => 1,
'0' => {
'name' => 'interrupt_cpu'
},
'type' => 'num'
}
}
}, 'ip_gen' );