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

Subversion Repositories rtf65002

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

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

Line No. Rev Author Line
1 20 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
// Datapath calculations - eight bit mode                                                                
22
// ============================================================================
23
//
24
BYTE_CALC:
25
        begin
26 32 robfinch
                state <= BYTE_IFETCH;
27
                wadr <= radr;
28
                wadr2LSB <= radr2LSB;
29
                store_what <= `STW_DEF;
30 20 robfinch
                case(ir[7:0])
31
                `ADC_IMM,`ADC_ZP,`ADC_ZPX,`ADC_IX,`ADC_IY,`ADC_ABS,`ADC_ABSX,`ADC_ABSY,`ADC_I:  begin res8 <= acc8 + b8 + {7'b0,cf}; end
32
                `SBC_IMM,`SBC_ZP,`SBC_ZPX,`SBC_IX,`SBC_IY,`SBC_ABS,`SBC_ABSX,`SBC_ABSY,`SBC_I:  begin res8 <= acc8 - b8 - {7'b0,~cf}; end
33
                `CMP_IMM,`CMP_ZP,`CMP_ZPX,`CMP_IX,`CMP_IY,`CMP_ABS,`CMP_ABSX,`CMP_ABSY,`CMP_I:  begin res8 <= acc8 - b8; end
34
                `AND_IMM,`AND_ZP,`AND_ZPX,`AND_IX,`AND_IY,`AND_ABS,`AND_ABSX,`AND_ABSY,`AND_I:  begin res8 <= acc8 & b8; end
35
                `ORA_IMM,`ORA_ZP,`ORA_ZPX,`ORA_IX,`ORA_IY,`ORA_ABS,`ORA_ABSX,`ORA_ABSY,`ORA_I:  begin res8 <= acc8 | b8; end
36
                `EOR_IMM,`EOR_ZP,`EOR_ZPX,`EOR_IX,`EOR_IY,`EOR_ABS,`EOR_ABSX,`EOR_ABSY,`EOR_I:  begin res8 <= acc8 ^ b8; end
37
                `LDA_IMM,`LDA_ZP,`LDA_ZPX,`LDA_IX,`LDA_IY,`LDA_ABS,`LDA_ABSX,`LDA_ABSY,`LDA_I: begin res8 <= b8; end
38
                `BIT_IMM,`BIT_ZP,`BIT_ZPX,`BIT_ABS,`BIT_ABSX:   begin res8 <= acc8 & b8; end
39 32 robfinch
                `TRB_ZP,`TRB_ABS:       begin res8 <= ~acc8 & b8; wdat <= {4{~acc8 & b8}}; state <= STORE1; end
40
                `TSB_ZP,`TSB_ABS:       begin res8 <= acc8 | b8; wdat <= {4{acc8 | b8}}; state <= STORE1; end
41 20 robfinch
                `LDX_IMM,`LDX_ZP,`LDX_ZPY,`LDX_ABS,`LDX_ABSY:   begin res8 <= b8; end
42
                `LDY_IMM,`LDY_ZP,`LDY_ZPX,`LDY_ABS,`LDY_ABSX:   begin res8 <= b8; end
43
                `CPX_IMM,`CPX_ZP,`CPX_ABS:      begin res8 <= x8 - b8; end
44
                `CPY_IMM,`CPY_ZP,`CPY_ABS:      begin res8 <= y8 - b8; end
45 32 robfinch
                `ASL_ZP,`ASL_ZPX,`ASL_ABS,`ASL_ABSX:    begin res8 <= {b8,1'b0}; wdat <= {4{b8[6:0],1'b0}}; state <= STORE1; end
46
                `ROL_ZP,`ROL_ZPX,`ROL_ABS,`ROL_ABSX:    begin res8 <= {b8,cf}; wdat <= {4{b8[6:0],cf}}; state <= STORE1; end
47
                `LSR_ZP,`LSR_ZPX,`LSR_ABS,`LSR_ABSX:    begin res8 <= {b8[0],1'b0,b8[7:1]}; wdat <= {4{1'b0,b8[7:1]}}; state <= STORE1; end
48
                `ROR_ZP,`ROR_ZPX,`ROR_ABS,`ROR_ABSX:    begin res8 <= {b8[0],cf,b8[7:1]}; wdat <= {4{cf,b8[7:1]}}; state <= STORE1; end
49
                `INC_ZP,`INC_ZPX,`INC_ABS,`INC_ABSX:    begin res8 <= b8 + 8'd1; wdat <= {4{b8+8'd1}}; state <= STORE1; end
50
                `DEC_ZP,`DEC_ZPX,`DEC_ABS,`DEC_ABSX:    begin res8 <= b8 - 8'd1; wdat <= {4{b8-8'd1}}; state <= STORE1; end
51 20 robfinch
                endcase
52
        end

powered by: WebSVN 2.1.0

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