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

Subversion Repositories klc32

[/] [klc32/] [trunk/] [rtl/] [verilog/] [INTA.v] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 robfinch
// ============================================================================
2
// (C) 2011 Robert Finch
3
// All Rights Reserved.
4
// robfinch<remove>@opencores.org
5
//
6
// KLC32 - 32 bit CPU
7
// INTA.v - interrupt acknowledge
8
//
9
// This source file is free software: you can redistribute it and/or modify 
10
// it under the terms of the GNU Lesser General Public License as published 
11
// by the Free Software Foundation, either version 3 of the License, or     
12
// (at your option) any later version.                                      
13
//                                                                          
14
// This source file is distributed in the hope that it will be useful,      
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
17
// GNU General Public License for more details.                             
18
//                                                                          
19
// You should have received a copy of the GNU General Public License        
20
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
21
//                                                                          
22
// ============================================================================
23
//
24
INTA:
25
        if (!cyc_o) begin
26
                fc_o <= 3'b111;
27
                inta_o <= 1'b1;
28
                cyc_o <= 1'b1;
29
                stb_o <= 1'b1;
30
                sel_o <= 4'b0001;
31
                adr_o <= {27'h7FFFFFF,iplr,2'b00};
32
        end
33
        else if (vpa_i) begin
34
                inta_o <= 1'b0;
35
                cyc_o <= 1'b0;
36
                stb_o <= 1'b0;
37
                sel_o <= 4'b0000;
38
                vecnum <= 32'd24 + iplr;
39
                state <= FETCH_VECTOR;
40
        end
41
        else if (ack_i) begin
42
                inta_o <= 1'b0;
43
                cyc_o <= 1'b0;
44
                stb_o <= 1'b0;
45
                sel_o <= 4'b0000;
46
                vecnum <= dat_i[7:0];
47
                state <= FETCH_VECTOR;
48
        end
49
        else if (err_i) begin
50
                inta_o <= 1'b0;
51
                cyc_o <= 1'b0;
52
                stb_o <= 1'b0;
53
                sel_o <= 4'b0000;
54
                vecnum <= 32'd24;               // Spurious interrupt
55
                state <= FETCH_VECTOR;
56
        end
57
FETCH_VECTOR:
58
        if (!cyc_o) begin
59
                fc_o <= 3'b101;
60
                cyc_o <= 1'b1;
61
                stb_o <= 1'b1;
62
                sel_o <= 4'b1111;
63
                adr_o <= {vecnum,2'b00};
64
        end
65
        else if (ack_i) begin
66
                cyc_o <= 1'b0;
67
                stb_o <= 1'b0;
68
                sel_o <= 4'b0000;
69
                vector <= dat_i;
70
                state <= TRAP1;
71
        end
72
        // I don't bother with bus error checking here because if the cpu can't read the
73
        // vector table, bus error processing won't help.
74
 

powered by: WebSVN 2.1.0

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