OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [s1_top/] [int_ctrl.v] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 fafa1971
/*
2
 * Interrupt Controller
3
 *
4
 * (C) 2007 Simply RISC LLP
5
 * AUTHOR: Fabrizio Fazzino <fabrizio.fazzino@srisc.com>
6
 *
7
 * LICENSE:
8
 * This is a Free Hardware Design; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * version 2 as published by the Free Software Foundation.
11
 * The above named program is distributed in the hope that it will
12
 * be useful, but WITHOUT ANY WARRANTY; without even the implied
13
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 * See the GNU General Public License for more details.
15
 *
16
 * DESCRIPTION:
17
 * This block implements the Interrupt Controller used by the S1
18
 * to detect if some peripheral raised an interrupt request.
19
 * A proper interrupt packet is sent to the SPARC Core by the
20
 * bridge with one of the 64 interrupt sources (provided by this
21
 * controller) encoded in the 6-bit Interrupt Source field.
22
 * Please note that IRQ 0 is reserved for Power-On Reset (handled
23
 * directly by the bridge) so up to 63 external peripherals can be
24
 * connected to the S1.
25
 * Note also that currently the interrupt vector is hardwired to
26
 * all zeroes.
27
 */
28
 
29
module int_ctrl (
30
    sys_clock_i, sys_reset_i, sys_irq_i,
31
    sys_interrupt_source_o
32
  );
33
 
34
  // System inputs
35
  input sys_clock_i;
36
  input sys_reset_i;
37
 
38
  // Incoming Interrupt Requests
39
  input[63:0] sys_irq_i;
40
 
41
  // Encoded Interrupt Source
42
  output[5:0] sys_interrupt_source_o;
43
  reg[5:0] sys_interrupt_source_o;
44
 
45
  // Encoding of the source using priority and ignoring IRQ 0
46
  always @(posedge sys_clock_i) begin
47
    if(sys_reset_i==1) sys_interrupt_source_o = 0;
48
    else if(sys_irq_i[63]) sys_interrupt_source_o = 63;
49
    else if(sys_irq_i[62]) sys_interrupt_source_o = 62;
50
    else if(sys_irq_i[61]) sys_interrupt_source_o = 61;
51
    else if(sys_irq_i[60]) sys_interrupt_source_o = 60;
52
    else if(sys_irq_i[59]) sys_interrupt_source_o = 59;
53
    else if(sys_irq_i[58]) sys_interrupt_source_o = 58;
54
    else if(sys_irq_i[57]) sys_interrupt_source_o = 57;
55
    else if(sys_irq_i[56]) sys_interrupt_source_o = 56;
56
    else if(sys_irq_i[55]) sys_interrupt_source_o = 55;
57
    else if(sys_irq_i[54]) sys_interrupt_source_o = 54;
58
    else if(sys_irq_i[53]) sys_interrupt_source_o = 53;
59
    else if(sys_irq_i[52]) sys_interrupt_source_o = 52;
60
    else if(sys_irq_i[51]) sys_interrupt_source_o = 51;
61
    else if(sys_irq_i[50]) sys_interrupt_source_o = 50;
62
    else if(sys_irq_i[49]) sys_interrupt_source_o = 49;
63
    else if(sys_irq_i[48]) sys_interrupt_source_o = 48;
64
    else if(sys_irq_i[47]) sys_interrupt_source_o = 47;
65
    else if(sys_irq_i[46]) sys_interrupt_source_o = 46;
66
    else if(sys_irq_i[45]) sys_interrupt_source_o = 45;
67
    else if(sys_irq_i[44]) sys_interrupt_source_o = 44;
68
    else if(sys_irq_i[43]) sys_interrupt_source_o = 43;
69
    else if(sys_irq_i[42]) sys_interrupt_source_o = 42;
70
    else if(sys_irq_i[41]) sys_interrupt_source_o = 41;
71
    else if(sys_irq_i[40]) sys_interrupt_source_o = 40;
72
    else if(sys_irq_i[39]) sys_interrupt_source_o = 39;
73
    else if(sys_irq_i[38]) sys_interrupt_source_o = 38;
74
    else if(sys_irq_i[37]) sys_interrupt_source_o = 37;
75
    else if(sys_irq_i[36]) sys_interrupt_source_o = 36;
76
    else if(sys_irq_i[35]) sys_interrupt_source_o = 35;
77
    else if(sys_irq_i[34]) sys_interrupt_source_o = 34;
78
    else if(sys_irq_i[33]) sys_interrupt_source_o = 33;
79
    else if(sys_irq_i[32]) sys_interrupt_source_o = 32;
80
    else if(sys_irq_i[31]) sys_interrupt_source_o = 31;
81
    else if(sys_irq_i[30]) sys_interrupt_source_o = 30;
82
    else if(sys_irq_i[29]) sys_interrupt_source_o = 29;
83
    else if(sys_irq_i[28]) sys_interrupt_source_o = 28;
84
    else if(sys_irq_i[27]) sys_interrupt_source_o = 27;
85
    else if(sys_irq_i[26]) sys_interrupt_source_o = 26;
86
    else if(sys_irq_i[25]) sys_interrupt_source_o = 25;
87
    else if(sys_irq_i[24]) sys_interrupt_source_o = 24;
88
    else if(sys_irq_i[23]) sys_interrupt_source_o = 23;
89
    else if(sys_irq_i[22]) sys_interrupt_source_o = 22;
90
    else if(sys_irq_i[21]) sys_interrupt_source_o = 21;
91
    else if(sys_irq_i[20]) sys_interrupt_source_o = 20;
92
    else if(sys_irq_i[19]) sys_interrupt_source_o = 19;
93
    else if(sys_irq_i[18]) sys_interrupt_source_o = 18;
94
    else if(sys_irq_i[17]) sys_interrupt_source_o = 17;
95
    else if(sys_irq_i[16]) sys_interrupt_source_o = 16;
96
    else if(sys_irq_i[15]) sys_interrupt_source_o = 15;
97
    else if(sys_irq_i[14]) sys_interrupt_source_o = 14;
98
    else if(sys_irq_i[13]) sys_interrupt_source_o = 13;
99
    else if(sys_irq_i[12]) sys_interrupt_source_o = 12;
100
    else if(sys_irq_i[11]) sys_interrupt_source_o = 11;
101
    else if(sys_irq_i[10]) sys_interrupt_source_o = 10;
102
    else if(sys_irq_i[9]) sys_interrupt_source_o = 9;
103
    else if(sys_irq_i[8]) sys_interrupt_source_o = 8;
104
    else if(sys_irq_i[7]) sys_interrupt_source_o = 7;
105
    else if(sys_irq_i[6]) sys_interrupt_source_o = 6;
106
    else if(sys_irq_i[5]) sys_interrupt_source_o = 5;
107
    else if(sys_irq_i[4]) sys_interrupt_source_o = 4;
108
    else if(sys_irq_i[3]) sys_interrupt_source_o = 3;
109
    else if(sys_irq_i[2]) sys_interrupt_source_o = 2;
110
    else if(sys_irq_i[1]) sys_interrupt_source_o = 1;
111
    else sys_interrupt_source_o = 0;
112
  end
113
 
114
endmodule

powered by: WebSVN 2.1.0

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