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

Subversion Repositories rtf65002

[/] [rtf65002/] [trunk/] [rtl/] [verilog/] [load_mac.v] - Blame information for rev 32

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

Line No. Rev Author Line
1 21 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2013  Robert Finch, Stratford
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@opencores.org
6
//       ||
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//                                                                          
21
// ============================================================================
22
//
23
LOAD_MAC1:
24 30 robfinch
`ifdef SUPPORT_DCACHE
25
        if (unCachedData)
26
`endif
27
        begin
28 21 robfinch
                if (isRMW)
29
                        lock_o <= 1'b1;
30
                cyc_o <= 1'b1;
31
                stb_o <= 1'b1;
32
                sel_o <= 4'hF;
33
                adr_o <= {radr,2'b00};
34
                state <= LOAD_MAC2;
35
        end
36 30 robfinch
`ifdef SUPPORT_DCACHE
37 32 robfinch
        else if (dhit)
38
                load_tsk(rdat,rdat8);
39
        else begin
40
                retstate <= LOAD_MAC1;
41
                state <= DCACHE1;
42 21 robfinch
        end
43 30 robfinch
`endif
44 21 robfinch
LOAD_MAC2:
45
        if (ack_i) begin
46
                cyc_o <= 1'b0;
47
                stb_o <= 1'b0;
48
                sel_o <= 4'h0;
49
                adr_o <= 34'h0;
50 32 robfinch
                load_tsk(dat_i,dati);
51 21 robfinch
        end
52 30 robfinch
`ifdef SUPPORT_BERR
53 21 robfinch
        else if (err_i) begin
54
                lock_o <= 1'b0;
55
                cyc_o <= 1'b0;
56
                stb_o <= 1'b0;
57
                we_o <= 1'b0;
58
                sel_o <= 4'h0;
59
                dat_o <= 32'h0;
60
                state <= BUS_ERROR;
61
        end
62 30 robfinch
`endif
63 32 robfinch
LOAD_MAC3:
64
        begin
65
                regfile[Rt] <= res;
66
                case(Rt)
67
                4'h1:   acc <= res;
68
                4'h2:   x <= res;
69
                4'h3:   y <= res;
70
                default:        ;
71
                endcase
72
                // Rt will be zero by the time the IFETCH stage is entered because of
73
                // the decrement below.
74
                if (Rt==4'd1)
75
                        state <= IFETCH;
76
                else begin
77
                        radr <= isp;
78
                        isp <= isp_inc;
79
                        state <= LOAD_MAC1;
80
                end
81
                Rt <= Rt - 4'd1;
82
        end
83
 
84 21 robfinch
RTS1:
85
        begin
86
                pc <= pc + 32'd1;
87 32 robfinch
                state <= BYTE_IFETCH;
88 21 robfinch
        end
89
IY3:
90
        begin
91
                radr <= radr + y;
92
                wadr <= radr + y;
93 32 robfinch
                if (ir9==`ST_IY) begin
94 30 robfinch
                        store_what <= `STW_A;
95 21 robfinch
                        state <= STORE1;
96 30 robfinch
                end
97 21 robfinch
                else begin
98
                        load_what <= `WORD_310;
99
                        state <= LOAD_MAC1;
100
                end
101
                isIY <= 1'b0;
102
        end
103 30 robfinch
`ifdef SUPPORT_EM8
104 21 robfinch
BYTE_IX5:
105
        begin
106
                radr <= ia[31:2];
107
                radr2LSB <= ia[1:0];
108
                load_what <= `BYTE_70;
109
                state <= LOAD_MAC1;
110
                if (ir[7:0]==`STA_IX || ir[7:0]==`STA_I) begin
111
                        wadr <= ia[31:2];
112
                        wadr2LSB <= ia[1:0];
113 30 robfinch
                        store_what <= `STW_ACC8;
114 21 robfinch
                        state <= STORE1;
115
                end
116
        end
117
BYTE_IY5:
118
        begin
119
                isIY <= `FALSE;
120
                radr <= iapy8[31:2];
121
                radr2LSB <= iapy8[1:0];
122
                $display("IY addr: %h", iapy8);
123
                if (ir[7:0]==`STA_IY) begin
124
                        wadr <= iapy8[31:2];
125
                        wadr2LSB <= iapy8[1:0];
126 30 robfinch
                        store_what <= `STW_ACC8;
127 21 robfinch
                        state <= STORE1;
128
                end
129
                else begin
130
                        load_what <= `BYTE_70;
131
                        state <= LOAD_MAC1;
132
                end
133
        end
134 30 robfinch
`endif

powered by: WebSVN 2.1.0

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