Line 3... |
Line 3... |
`include "defines.v"
|
`include "defines.v"
|
|
|
|
|
module controlUnit (clk, reset, instOpCode, acc0, iomemCode,
|
module controlUnit (clk, reset, instOpCode, acc0, iomemCode,
|
branch,
|
branch,
|
accMuxSel, accEn, op2MuxSel, aluOpcode,
|
accMuxSel, accEn, op2MuxSel, aluEn, aluOpcode,
|
bitRamEn, bitRamRw, byteRamEn, byteRamRw,
|
bitRamEn, bitRamRw, byteRamEn, byteRamRw,
|
inputRead, outputRw
|
inputRead, outputRw
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
, entypeEn, tcAccRead, tcResetEn, tcPresetEn, tcLoadEn
|
, entypeEn, tcAccRead, tcResetEn, tcPresetEn, tcLoadEn
|
Line 31... |
Line 31... |
|
|
output branch;
|
output branch;
|
output [`accMuxSelLen-1:0] accMuxSel;
|
output [`accMuxSelLen-1:0] accMuxSel;
|
output accEn;
|
output accEn;
|
output [`op2MuxSelLen-1:0] op2MuxSel;
|
output [`op2MuxSelLen-1:0] op2MuxSel;
|
|
output aluEn;
|
output [`aluOpcodeLen-1:0] aluOpcode;
|
output [`aluOpcodeLen-1:0] aluOpcode;
|
output bitRamEn, bitRamRw, byteRamEn, byteRamRw;
|
output bitRamEn, bitRamRw, byteRamEn, byteRamRw;
|
output inputRead, outputRw;
|
output inputRead, outputRw;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
Line 51... |
Line 52... |
|
|
reg branch;
|
reg branch;
|
reg [`accMuxSelLen-1:0] accMuxSel;
|
reg [`accMuxSelLen-1:0] accMuxSel;
|
reg accEn;
|
reg accEn;
|
reg [`op2MuxSelLen-1:0] op2MuxSel;
|
reg [`op2MuxSelLen-1:0] op2MuxSel;
|
|
reg aluEn;
|
reg [`aluOpcodeLen-1:0] aluOpcode;
|
reg [`aluOpcodeLen-1:0] aluOpcode;
|
reg bitRamEn, bitRamRw, byteRamEn, byteRamRw;
|
reg bitRamEn, bitRamRw, byteRamEn, byteRamRw;
|
reg inputRead, outputRw;
|
reg inputRead, outputRw;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
Line 91... |
Line 93... |
|
|
if (reset)
|
if (reset)
|
begin
|
begin
|
state = s;
|
state = s;
|
|
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0; aluOpcode = 0; bitRamEn = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0; aluEn = 0; aluOpcode = 0; bitRamEn = 0;
|
bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 127... |
Line 129... |
|
|
branch = 1; // branch to some address . . .
|
branch = 1; // branch to some address . . .
|
accMuxSel = 0;
|
accMuxSel = 0;
|
accEn = 0;
|
accEn = 0;
|
op2MuxSel = 0;
|
op2MuxSel = 0;
|
|
aluEn = 0;
|
aluOpcode = 0;
|
aluOpcode = 0;
|
bitRamEn = 0;
|
bitRamEn = 0;
|
bitRamRw = 1;
|
bitRamRw = 1;
|
byteRamEn = 0;
|
byteRamEn = 0;
|
byteRamRw = 1;
|
byteRamRw = 1;
|
Line 156... |
Line 159... |
|
|
`JMP : begin
|
`JMP : begin
|
|
|
state = sBr;
|
state = sBr;
|
|
|
|
if (acc0)
|
branch = 1; // branch to some address . . .
|
branch = 1; // branch to some address . . .
|
|
else
|
|
branch = 0;
|
accMuxSel = 0;
|
accMuxSel = 0;
|
accEn = 0;
|
accEn = 0;
|
op2MuxSel = 0;
|
op2MuxSel = 0;
|
|
aluEn = 0;
|
aluOpcode = 0;
|
aluOpcode = 0;
|
bitRamEn = 0;
|
bitRamEn = 0;
|
bitRamRw = 1;
|
bitRamRw = 1;
|
byteRamEn = 0;
|
byteRamEn = 0;
|
byteRamRw = 1;
|
byteRamRw = 1;
|
Line 199... |
Line 206... |
2'b01 : op2MuxSel = `op2MuxSelOutput;
|
2'b01 : op2MuxSel = `op2MuxSelOutput;
|
2'b10 : op2MuxSel = `op2MuxSelBitRam;
|
2'b10 : op2MuxSel = `op2MuxSelBitRam;
|
2'b11 : op2MuxSel = `op2MuxSelByteRam;
|
2'b11 : op2MuxSel = `op2MuxSelByteRam;
|
default: op2MuxSel = `op2MuxSelInput;
|
default: op2MuxSel = `op2MuxSelInput;
|
endcase
|
endcase
|
|
aluEn = 1;
|
aluOpcode = `LD_data;
|
aluOpcode = `LD_data;
|
|
|
bitRamEn = 0;
|
bitRamEn = 1;
|
bitRamRw = 1;
|
bitRamRw = 1;
|
byteRamEn = 0;
|
byteRamEn = 1;
|
byteRamRw = 1;
|
byteRamRw = 1;
|
inputRead = 0;
|
inputRead = 1;
|
outputRw = 1;
|
outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 234... |
Line 241... |
branch = 0;
|
branch = 0;
|
accMuxSel = `accMuxSelImmData; // select imm data thr mux
|
accMuxSel = `accMuxSelImmData; // select imm data thr mux
|
accEn = 1; // acc enabled
|
accEn = 1; // acc enabled
|
op2MuxSel = 0;
|
op2MuxSel = 0;
|
aluOpcode = 0;
|
aluOpcode = 0;
|
|
aluEn = 0;
|
bitRamEn = 0;
|
bitRamEn = 0;
|
bitRamRw = 1;
|
bitRamRw = 1;
|
byteRamEn = 0;
|
byteRamEn = 0;
|
byteRamRw = 1;
|
byteRamRw = 1;
|
inputRead = 0;
|
inputRead = 0;
|
Line 264... |
Line 272... |
|
|
branch = 0;
|
branch = 0;
|
accMuxSel = 0;
|
accMuxSel = 0;
|
accEn = 0;
|
accEn = 0;
|
op2MuxSel = 0;
|
op2MuxSel = 0;
|
|
aluEn = 0;
|
aluOpcode = 0;
|
aluOpcode = 0;
|
bitRamRw = 0;
|
|
byteRamRw = 0;
|
|
inputRead = 0;
|
inputRead = 0;
|
|
|
case (iomemCode)
|
case (iomemCode)
|
2'b01 : begin bitRamRw = 0; byteRamRw = 1; outputRw = 1; end
|
2'b01 : begin bitRamRw = 0; byteRamRw = 1; outputRw = 1; bitRamEn = 1; byteRamEn = 1; end
|
2'b10 : begin bitRamRw = 1; byteRamRw = 0; outputRw = 1; end
|
2'b10 : begin bitRamRw = 1; byteRamRw = 0; outputRw = 1; bitRamEn = 1; byteRamEn = 1; end
|
2'b11 : begin bitRamRw = 1; byteRamRw = 1; outputRw = 0; end
|
2'b11 : begin bitRamRw = 1; byteRamRw = 1; outputRw = 0; end
|
default: begin bitRamRw = 1; byteRamRw = 1; outputRw = 1; end
|
default: begin bitRamRw = 1; byteRamRw = 1; outputRw = 1; end
|
endcase
|
endcase
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
Line 295... |
Line 302... |
|
|
|
|
`ADD : begin
|
`ADD : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `ADD_alu;
|
aluOpcode = `ADD_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 317... |
Line 324... |
|
|
|
|
`SUB : begin
|
`SUB : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `SUB_alu;
|
aluOpcode = `SUB_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 342... |
Line 349... |
|
|
|
|
`AND : begin
|
`AND : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `AND_alu;
|
aluOpcode = `AND_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 365... |
Line 372... |
|
|
|
|
`OR : begin
|
`OR : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `OR_alu;
|
aluOpcode = `OR_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 388... |
Line 395... |
|
|
|
|
`XOR : begin
|
`XOR : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `XOR_alu;
|
aluOpcode = `XOR_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 411... |
Line 418... |
|
|
|
|
`GrT : begin
|
`GrT : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `GT_alu;
|
aluOpcode = `GT_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 436... |
Line 443... |
|
|
|
|
`GE : begin
|
`GE : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `GE_alu;
|
aluOpcode = `GE_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 461... |
Line 468... |
|
|
|
|
`EQ : begin
|
`EQ : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `EQ_alu;
|
aluOpcode = `EQ_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 486... |
Line 493... |
|
|
|
|
`LE : begin
|
`LE : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `LE_alu;
|
aluOpcode = `LE_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 511... |
Line 518... |
|
|
|
|
`LT : begin
|
`LT : begin
|
state = sAlu;
|
state = sAlu;
|
aluOpcode = `LT_alu;
|
aluOpcode = `LT_alu;
|
|
aluEn = 1;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timeAndCounter_peripheral
|
`ifdef timeAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
Line 537... |
Line 544... |
state = sTc;
|
state = sTc;
|
|
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 1; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 1; tcLoadEn = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
|
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
uartRead = 0; uartWrite = 0;
|
uartRead = 0; uartWrite = 0;
|
Line 559... |
Line 566... |
state = sTc;
|
state = sTc;
|
|
|
entypeEn = 1; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 1; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
|
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
uartRead = 0; uartWrite = 0;
|
uartRead = 0; uartWrite = 0;
|
Line 582... |
Line 589... |
state = sTc;
|
state = sTc;
|
|
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 1; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 1; tcPresetEn = 0; tcLoadEn = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
|
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
uartRead = 0; uartWrite = 0;
|
uartRead = 0; uartWrite = 0;
|
Line 606... |
Line 613... |
|
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 1;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 1;
|
|
|
accMuxSel = `accMuxSelTcLoad; accEn = 1; // loading TC status data
|
accMuxSel = `accMuxSelTcLoad; accEn = 1; // loading TC status data
|
|
|
aluOpcode = 0; branch = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
|
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
uartRead = 0; uartWrite = 0;
|
uartRead = 0; uartWrite = 0;
|
Line 630... |
Line 637... |
|
|
entypeEn = 0; tcAccRead = 1; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 1; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
|
|
accMuxSel = `accMuxSelTcAcc; accEn = 1; // loading TC ACC data
|
accMuxSel = `accMuxSelTcAcc; accEn = 1; // loading TC ACC data
|
|
|
aluOpcode = 0; branch = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
|
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
uartRead = 0; uartWrite = 0;
|
uartRead = 0; uartWrite = 0;
|
Line 655... |
Line 662... |
|
|
uartRead = 1; uartWrite = 0;
|
uartRead = 1; uartWrite = 0;
|
|
|
accMuxSel = `accMuxSelUart; accEn = 1; // loading UART data
|
accMuxSel = `accMuxSelUart; accEn = 1; // loading UART data
|
|
|
aluOpcode = 0; branch = 0;op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0;op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 678... |
Line 685... |
`UARTwr : begin
|
`UARTwr : begin
|
state = sUart;
|
state = sUart;
|
|
|
uartRead = 0; uartWrite = 1;
|
uartRead = 0; uartWrite = 1;
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 702... |
Line 709... |
state = sSpi;
|
state = sSpi;
|
|
|
sconEn = 1; spiStatRead = 0; spiBufRead = 0; spiBufWrite = 0; spiBufShift = 0;
|
sconEn = 1; spiStatRead = 0; spiBufRead = 0; spiBufWrite = 0; spiBufShift = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 725... |
Line 732... |
state = sSpi;
|
state = sSpi;
|
|
|
sconEn = 0; spiStatRead = 1; spiBufRead = 0; spiBufWrite = 0; spiBufShift = 0;
|
sconEn = 0; spiStatRead = 1; spiBufRead = 0; spiBufWrite = 0; spiBufShift = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 748... |
Line 755... |
state = sSpi;
|
state = sSpi;
|
|
|
sconEn = 0; spiStatRead = 0; spiBufRead = 0; spiBufWrite = 1; spiBufShift = 0;
|
sconEn = 0; spiStatRead = 0; spiBufRead = 0; spiBufWrite = 1; spiBufShift = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 771... |
Line 778... |
state = sSpi;
|
state = sSpi;
|
|
|
sconEn = 0; spiStatRead = 0; spiBufRead = 1; spiBufWrite = 0; spiBufShift = 0;
|
sconEn = 0; spiStatRead = 0; spiBufRead = 1; spiBufWrite = 0; spiBufShift = 0;
|
|
|
|
|
aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
aluEn = 0; aluOpcode = 0; branch = 0; accMuxSel = 0; accEn = 0; op2MuxSel = 0;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
bitRamEn = 0; bitRamRw = 1; byteRamEn = 0; byteRamRw = 1; inputRead = 0; outputRw = 1;
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
entypeEn = 0; tcAccRead = 0; tcResetEn = 0; tcPresetEn = 0; tcLoadEn = 0;
|
`endif
|
`endif
|
Line 804... |
Line 811... |
state = s;
|
state = s;
|
end // end case sBr
|
end // end case sBr
|
|
|
|
|
sLd : begin
|
sLd : begin
|
accEn = 0;
|
aluEn = 0;
|
|
accEn = 1;
|
|
accMuxSel = `accMuxSelAluOut;
|
state = s;
|
state = s;
|
end // end case sLd
|
end // end case sLd
|
|
|
sSt : begin
|
sSt : begin
|
bitRamRw = 1; byteRamRw = 1; outputRw = 1;
|
bitRamRw = 1; byteRamRw = 1; outputRw = 1;
|
state = s;
|
state = s;
|
end
|
end
|
|
|
sAlu : begin
|
sAlu : begin
|
|
aluEn = 0;
|
accEn = 1;
|
accEn = 1;
|
accMuxSel = `accMuxSelAluOut;
|
accMuxSel = `accMuxSelAluOut;
|
state = s;
|
state = s;
|
end
|
end
|
|
|