No success yet. Just thought I'd share what I've got so far...
Opcodes for the B Accumulator are simple, not thought through at all.
For example, an LDA #$xxxx would look like $00A9, $xxxx in Hex Editor.
With a B Accumulator, a Macro/.BYTE on As65 using an LDB #$xxxx
presently looks like $A9A9, $xxxx.
Following this thought process will not allow for further opcode expansion regarding Accumulators. I'm just concentrating on getting the first B Accumulator functional, then I can think on how to properly expand the opcode set further...
Since regsel has now been expanded to 3bits, there is the opportunity for 8 16-bit registers in the regfile.
Only 5 (B,A,X,Y,S) are being used now:
Code:
reg [2:0] regsel; // Select B, A, X, Y or S register
wire [15:0] regfile = BAXYS[regsel]; // Selected register output
Code:
reg [15:0] BAXYS[4:0]; // B, A, X, Y and S register file
Code:
parameter
SEL_A = 3'd0,
SEL_S = 3'd1,
SEL_X = 3'd2,
SEL_Y = 3'd3,
SEL_B = 3'd4;
initial
begin
BAXYS[SEL_B] = 0; //init 2nd accumulator
BAXYS[SEL_A] = 0; //init accumulator
BAXYS[SEL_X] = 0; //init x register
BAXYS[SEL_Y] = 0; //init y register
BAXYS[SEL_S] = 16'hffff; //init stack
end
Code:
reg [2:0] src_reg; // source register index
reg [2:0] dst_reg; // destination register index