Line 56... |
Line 56... |
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
wire entypeEnOutc, tcAccReadOutc, tcResetEnOutc, tcPresetEnOutc, tcLoadEnOutc;
|
wire entypeEnOutc, tcAccReadOutc, tcResetEnOutc, tcPresetEnOutc, tcLoadEnOutc;
|
`endif
|
`endif
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
wire uartReadOutc, uartWriteOutc;
|
wire uartReadOutc, uartWriteOutc;
|
|
wire [7:0] uartDataOut;
|
|
wire rxEmpty, txFull;
|
`endif
|
`endif
|
`ifdef SPI_peripheral
|
`ifdef SPI_peripheral
|
wire sconEnOutc, spiStatReadOutc, spiBufReadOutc, spiBufWriteOutc, spiBufShiftOutc;
|
wire sconEnOutc, spiStatReadOutc, spiBufReadOutc, spiBufWriteOutc, spiBufShiftOutc;
|
`endif
|
`endif
|
|
|
Line 86... |
Line 88... |
// wires (interconnects) of timer & counter
|
// wires (interconnects) of timer & counter
|
|
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
|
|
wire [(`tcNumbers*`tcPresetLen)-1:0] presetWires;
|
wire [(`tcNumbers*`tcPresetLen)-1:0] presetWires;
|
wire [7:0] tcAccumOut;
|
wire [7:0] tcAccOut;
|
wire [7:0] tcLoadOut;
|
wire [7:0] tcLoadOut;
|
wire [`tcNumbers-1:0] enWires;
|
wire [`tcNumbers-1:0] enWires;
|
wire [`tcNumbers-1:0] resetWires;
|
wire [`tcNumbers-1:0] resetWires;
|
wire [`tcNumbers-1:0] dnWires, ttWires, cuWires, cdWires;
|
wire [`tcNumbers-1:0] dnWires, ttWires, cuWires, cdWires;
|
wire [(`tcNumbers*2)-1:0] typeWires;
|
wire [(`tcNumbers*2)-1:0] typeWires;
|
Line 116... |
Line 118... |
|
|
|
|
//-------- Fetch Unit Module Instances
|
//-------- Fetch Unit Module Instances
|
// all necessary
|
// all necessary
|
|
|
pgmCounter ProgramCounter (clk, reset, branchOutc, instField[7:0], pcOut);
|
pgmCounter ProgramCounter (clk, reset, branchOutc, instField[9:0], pcOut);
|
|
|
|
|
// instruction ROM is declared using xilinx primitive
|
// instruction ROM is declared using xilinx primitive
|
RAMB16_S18 rom ( .DI(),
|
RAMB16_S18 rom ( .DI(),
|
.DIP(),
|
.DIP(),
|
Line 130... |
Line 132... |
.SSR(1'b0),
|
.SSR(1'b0),
|
.CLK(clk),
|
.CLK(clk),
|
.DO(romOut),
|
.DO(romOut),
|
.DOP());
|
.DOP());
|
|
|
instReg IntructionRegister (romOut, instOpCode, instField);
|
// instReg IntructionRegister (romOut, instOpCode, instField);
|
|
|
|
|
// pipeline register
|
// pipeline register
|
|
|
wire [`instOpCodeLen-1:0] instOpCode1;
|
wire [`instOpCodeLen-1:0] instOpCode1;
|
wire [`instFieldLen-1:0] instField1;
|
wire [`instFieldLen-1:0] instField1;
|
wire [`instFieldLen-1:0] instField2;
|
wire [`instFieldLen-1:0] instField2;
|
|
|
ppReg1 PipeLine_Reg1 (clk, instOpCode, instField, instOpCode1, instField1);
|
ppReg1 PipeLine_Reg1 (clk, romOut[`instLen-1:`instLen-`instOpCodeLen], romOut[`instFieldLen-1:0], instOpCode1, instField1);
|
|
|
|
|
//-------- Control Unit Module Instance
|
//-------- Control Unit Module Instance
|
|
|
controlUnit CONTROL_UNIT (clk, reset, instOpCode1, accOut[0], instField2[8:7],
|
controlUnit CONTROL_UNIT (clk, reset, instOpCode1, accOut[0], instField2[8:7],
|
Line 213... |
Line 215... |
accumulatorMUX accMUX1 (accMuxSelOut, instField2[7:0], aluOut
|
accumulatorMUX accMUX1 (accMuxSelOut, instField2[7:0], aluOut
|
`ifdef timerAndCounter_peripheral
|
`ifdef timerAndCounter_peripheral
|
, tcLoadOut, tcAccOut
|
, tcLoadOut, tcAccOut
|
`endif
|
`endif
|
`ifdef UART_peripheral
|
`ifdef UART_peripheral
|
, uartDataOut
|
, uartDataOut, {rxEmpty, txFull}
|
`endif
|
`endif
|
`ifdef SPI_peripheral
|
`ifdef SPI_peripheral
|
, spiStatOut, spiBufOut
|
, spiStatOut, spiBufOut
|
`endif
|
`endif
|
, accMuxOut
|
, accMuxOut
|
Line 259... |
Line 261... |
|
|
|
|
|
|
tcEnableAndType tcEnableAndTypeModule(entypeEnOut, instField2[6], instField2[5:4], instField2[3:0], enWires, typeWires);
|
tcEnableAndType tcEnableAndTypeModule(entypeEnOut, instField2[6], instField2[5:4], instField2[3:0], enWires, typeWires);
|
|
|
tcAccum tcAccumModule(tcAccumReadOut, instField2[3:0], tcAccumWires, tcAccOut);
|
tcAccum tcAccumModule(tcAccReadOut, instField2[3:0], tcAccWires, tcAccOut);
|
|
|
tcReset tcResetModule(tcResetEnOut, instField2[4], instField2[3:0], resetWires);
|
tcReset tcResetModule(tcResetEnOut, instField2[4], instField2[3:0], resetWires);
|
|
|
tcPreset tcPresetModule(tcPresetEnOut, accOut, instField2[3:0], presetWires);
|
tcPreset tcPresetModule(tcPresetEnOut, accOut, instField2[3:0], presetWires);
|
|
|