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

Subversion Repositories rtf65002

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

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 35 robfinch
                wb_read({radr,2'b00});
31 21 robfinch
                state <= LOAD_MAC2;
32
        end
33 30 robfinch
`ifdef SUPPORT_DCACHE
34 32 robfinch
        else if (dhit)
35
                load_tsk(rdat,rdat8);
36
        else begin
37
                retstate <= LOAD_MAC1;
38
                state <= DCACHE1;
39 21 robfinch
        end
40 30 robfinch
`endif
41 21 robfinch
LOAD_MAC2:
42
        if (ack_i) begin
43 35 robfinch
                wb_nack();
44 32 robfinch
                load_tsk(dat_i,dati);
45 21 robfinch
        end
46 30 robfinch
`ifdef SUPPORT_BERR
47 21 robfinch
        else if (err_i) begin
48
                lock_o <= 1'b0;
49 35 robfinch
                wb_nack();
50
                if (em | isOrb)
51
                        derr_address <= adr_o[31:0];
52
                else
53
                        derr_address <= adr_o[33:2];
54
                intno <= 9'd508;
55 21 robfinch
                state <= BUS_ERROR;
56
        end
57 30 robfinch
`endif
58 32 robfinch
LOAD_MAC3:
59
        begin
60 35 robfinch
                regfile[Rt] <= res[31:0];
61 32 robfinch
                case(Rt)
62 35 robfinch
                4'h1:   acc <= res[31:0];
63
                4'h2:   x <= res[31:0];
64
                4'h3:   y <= res[31:0];
65 32 robfinch
                default:        ;
66
                endcase
67
                // Rt will be zero by the time the IFETCH stage is entered because of
68
                // the decrement below.
69
                if (Rt==4'd1)
70
                        state <= IFETCH;
71
                else begin
72
                        radr <= isp;
73
                        isp <= isp_inc;
74
                        state <= LOAD_MAC1;
75
                end
76
                Rt <= Rt - 4'd1;
77
        end
78
 
79 21 robfinch
RTS1:
80
        begin
81
                pc <= pc + 32'd1;
82 32 robfinch
                state <= BYTE_IFETCH;
83 21 robfinch
        end
84
IY3:
85
        begin
86
                radr <= radr + y;
87
                wadr <= radr + y;
88 32 robfinch
                if (ir9==`ST_IY) begin
89 30 robfinch
                        store_what <= `STW_A;
90 21 robfinch
                        state <= STORE1;
91 30 robfinch
                end
92 21 robfinch
                else begin
93
                        load_what <= `WORD_310;
94
                        state <= LOAD_MAC1;
95
                end
96
                isIY <= 1'b0;
97
        end
98 30 robfinch
`ifdef SUPPORT_EM8
99 21 robfinch
BYTE_IX5:
100
        begin
101
                radr <= ia[31:2];
102
                radr2LSB <= ia[1:0];
103
                load_what <= `BYTE_70;
104
                state <= LOAD_MAC1;
105
                if (ir[7:0]==`STA_IX || ir[7:0]==`STA_I) begin
106
                        wadr <= ia[31:2];
107
                        wadr2LSB <= ia[1:0];
108 30 robfinch
                        store_what <= `STW_ACC8;
109 21 robfinch
                        state <= STORE1;
110
                end
111
        end
112
BYTE_IY5:
113
        begin
114
                isIY <= `FALSE;
115
                radr <= iapy8[31:2];
116
                radr2LSB <= iapy8[1:0];
117
                $display("IY addr: %h", iapy8);
118
                if (ir[7:0]==`STA_IY) begin
119
                        wadr <= iapy8[31:2];
120
                        wadr2LSB <= iapy8[1:0];
121 30 robfinch
                        store_what <= `STW_ACC8;
122 21 robfinch
                        state <= STORE1;
123
                end
124
                else begin
125
                        load_what <= `BYTE_70;
126
                        state <= LOAD_MAC1;
127
                end
128
        end
129 30 robfinch
`endif

powered by: WebSVN 2.1.0

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