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

Subversion Repositories klc32

[/] [klc32/] [trunk/] [rtl/] [verilog/] [RTI.v] - Blame information for rev 2

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
// RTI.v - return from interrupt / trap
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
RTI1:
25
        if (!cyc_o) begin
26
                fc_o <= {3'b101};
27
                cyc_o <= 1'b1;
28
                stb_o <= 1'b1;
29
                sel_o <= 4'b1111;
30
                adr_o <= ssp;
31
        end
32
        else if (ack_i) begin
33
                stb_o <= 1'b0;
34
                sel_o <= 4'b0000;
35
                im <= dat_i[18:16];
36
                sf <= dat_i[21];
37
                tf <= dat_i[23];
38
                ssp <= ssp + 32'd4;
39
                state <= RTI2;
40
        end
41
RTI2:
42
        if (!stb_o) begin
43
                fc_o <= {3'b101};
44
                stb_o <= 1'b1;
45
                sel_o <= 4'b1111;
46
                adr_o <= ssp;
47
        end
48
        else if (ack_i) begin
49
                stb_o <= 1'b0;
50
                sel_o <= 4'b0000;
51
                cr0 <= dat_i[3:0];
52
                cr1 <= dat_i[7:4];
53
                cr2 <= dat_i[11:8];
54
                cr3 <= dat_i[15:12];
55
                cr4 <= dat_i[19:16];
56
                cr5 <= dat_i[23:20];
57
                cr6 <= dat_i[27:24];
58
                cr7 <= dat_i[31:28];
59
                ssp <= ssp + 32'd4;
60
                state <= RTI3;
61
        end
62
RTI3:
63
        if (!stb_o) begin
64
                fc_o <= {3'b101};
65
                stb_o <= 1'b1;
66
                sel_o <= 4'b1111;
67
                adr_o <= ssp;
68
        end
69
        else if (ack_i) begin
70
                cyc_o <= 1'b0;
71
                stb_o <= 1'b0;
72
                sel_o <= 4'b0000;
73
                pc <= dat_i;
74
                ssp <= ssp + 32'd4;
75
                state <= IFETCH;
76
        end

powered by: WebSVN 2.1.0

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