Line 1... |
Line 1... |
// Potrebno narediti STALL procesorja pri read-u in write-u
|
|
|
|
// Potrebno racunati crc kadar je izbran trace. Ko delamo read iz bufferja
|
// Potrebno racunati crc kadar je izbran trace. Ko delamo read iz bufferja
|
// Dodati registre RISCOP
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// dbg_top.v ////
|
//// dbg_top.v ////
|
Line 49... |
Line 47... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.1.1.1 2001/09/13 13:49:19 mohor
|
|
// Initial official release.
|
|
//
|
// Revision 1.3 2001/06/01 22:22:35 mohor
|
// Revision 1.3 2001/06/01 22:22:35 mohor
|
// This is a backup. It is not a fully working version. Not for use, yet.
|
// This is a backup. It is not a fully working version. Not for use, yet.
|
//
|
//
|
// Revision 1.2 2001/05/18 13:10:00 mohor
|
// Revision 1.2 2001/05/18 13:10:00 mohor
|
// Headers changed. All additional information is now avaliable in the README.txt file.
|
// Headers changed. All additional information is now avaliable in the README.txt file.
|
Line 65... |
Line 66... |
`include "dbg_timescale.v"
|
`include "dbg_timescale.v"
|
`include "dbg_defines.v"
|
`include "dbg_defines.v"
|
|
|
// Top module
|
// Top module
|
module dbg_top(P_TMS, P_TCK, P_TRST, P_TDI, P_TDO, P_PowerONReset, Mclk, RISC_ADDR, RISC_DATA_IN,
|
module dbg_top(P_TMS, P_TCK, P_TRST, P_TDI, P_TDO, P_PowerONReset, Mclk, RISC_ADDR, RISC_DATA_IN,
|
RISC_DATA_OUT, RISC_CS, RISC_RW, Wp, Bp, OpSelect, LsStatus, IStatus
|
RISC_DATA_OUT, RISC_CS, RISC_RW, Wp, Bp, OpSelect, LsStatus, IStatus,
|
|
RISC_STALL_O, RISC_RESET_O, BS_CHAIN_I
|
);
|
);
|
|
|
parameter Tp = 1;
|
parameter Tp = 1;
|
|
|
input P_TMS, P_TCK;
|
input P_TMS, P_TCK;
|
Line 79... |
Line 81... |
input [31:0] RISC_DATA_IN;
|
input [31:0] RISC_DATA_IN;
|
input [10:0] Wp;
|
input [10:0] Wp;
|
input Bp;
|
input Bp;
|
input [3:0] LsStatus;
|
input [3:0] LsStatus;
|
input [1:0] IStatus;
|
input [1:0] IStatus;
|
|
input BS_CHAIN_I;
|
|
|
output P_TDO;
|
output P_TDO;
|
output [31:0] RISC_ADDR;
|
output [31:0] RISC_ADDR;
|
output [31:0] RISC_DATA_OUT;
|
output [31:0] RISC_DATA_OUT;
|
output [`OPSELECTWIDTH-1:0] OpSelect;
|
output [`OPSELECTWIDTH-1:0] OpSelect;
|
output RISC_CS; // CS for accessing RISC registers
|
output RISC_CS; // CS for accessing RISC registers
|
output RISC_RW; // RW for accessing RISC registers
|
output RISC_RW; // RW for accessing RISC registers
|
|
output RISC_STALL_O; // Stalls the RISC
|
|
output RISC_RESET_O; // Resets the RISC
|
|
|
reg [31:0] RISC_ADDR;
|
reg [31:0] RISC_ADDR;
|
reg [31:0] ADDR;
|
reg [31:0] ADDR;
|
reg [31:0] RISC_DATA_OUT;
|
reg [31:0] RISC_DATA_OUT;
|
reg [31:0] DataOut;
|
reg [31:0] DataOut;
|
Line 155... |
Line 160... |
reg DisableReadBuffer_Mclk; // Incrementing trace read buffer can be active for one MClk clock. Then it is disabled.
|
reg DisableReadBuffer_Mclk; // Incrementing trace read buffer can be active for one MClk clock. Then it is disabled.
|
|
|
// Outputs from registers
|
// Outputs from registers
|
wire ContinMode;
|
wire ContinMode;
|
wire TraceEnable;
|
wire TraceEnable;
|
wire RecSelDepend;
|
|
|
|
wire [10:0] WpTrigger;
|
wire [10:0] WpTrigger;
|
wire BpTrigger;
|
wire BpTrigger;
|
wire [3:0] LSSTrigger;
|
wire [3:0] LSSTrigger;
|
wire [1:0] ITrigger;
|
wire [1:0] ITrigger;
|
Line 190... |
Line 194... |
wire WpStopValid;
|
wire WpStopValid;
|
wire BpStopValid;
|
wire BpStopValid;
|
wire LSSStopValid;
|
wire LSSStopValid;
|
wire IStopValid;
|
wire IStopValid;
|
|
|
wire [10:0] RecordPC_Wp;
|
wire RecordPC;
|
wire [10:0] RecordLSEA_Wp;
|
wire RecordLSEA;
|
wire [10:0] RecordLDATA_Wp;
|
wire RecordLDATA;
|
wire [10:0] RecordSDATA_Wp;
|
wire RecordSDATA;
|
wire [10:0] RecordReadSPR_Wp;
|
wire RecordReadSPR;
|
wire [10:0] RecordWriteSPR_Wp;
|
wire RecordWriteSPR;
|
wire [10:0] RecordINSTR_Wp;
|
wire RecordINSTR;
|
|
|
wire RecordPC_Bp;
|
|
wire RecordLSEA_Bp;
|
|
wire RecordLDATA_Bp;
|
|
wire RecordSDATA_Bp;
|
|
wire RecordReadSPR_Bp;
|
|
wire RecordWriteSPR_Bp;
|
|
wire RecordINSTR_Bp;
|
|
// End: Outputs from registers
|
// End: Outputs from registers
|
|
|
wire TraceTestScanChain; // Trace Test Scan chain selected
|
wire TraceTestScanChain; // Trace Test Scan chain selected
|
|
|
wire [47:0] Trace_Data;
|
wire [47:0] Trace_Data;
|
|
|
`endif
|
`endif
|
|
|
|
wire RiscStall_reg;
|
|
wire RiscReset_reg;
|
|
wire RiscStall_trace;
|
|
|
|
|
wire RegisterScanChain; // Register Scan chain selected
|
wire RegisterScanChain; // Register Scan chain selected
|
wire RiscDebugScanChain; // Risc Debug Scan chain selected
|
wire RiscDebugScanChain; // Risc Debug Scan chain selected
|
|
|
Line 725... |
Line 724... |
|
|
assign RISC_CS = RISCAccess & ~RISCAccess_q;
|
assign RISC_CS = RISCAccess & ~RISCAccess_q;
|
assign RISC_RW = RW;
|
assign RISC_RW = RW;
|
|
|
|
|
|
`ifdef TRACE_ENABLED
|
|
assign RISC_STALL_O = RISC_CS | RiscStall_reg | RiscStall_trace ;
|
|
`else
|
|
assign RISC_STALL_O = RISC_CS | RiscStall_reg;
|
|
`endif
|
|
|
|
assign RISC_RESET_O = RiscReset_reg;
|
|
|
|
|
reg [31:0] RISC_DATA_IN_TEMP;
|
reg [31:0] RISC_DATA_IN_TEMP;
|
// Latching data read from RISC
|
// Latching data read from RISC
|
always @ (posedge Mclk or posedge RESET)
|
always @ (posedge Mclk or posedge RESET)
|
begin
|
begin
|
if(RESET)
|
if(RESET)
|
Line 805... |
Line 813... |
* End: Bypass logic *
|
* End: Bypass logic *
|
* *
|
* *
|
**********************************************************************************/
|
**********************************************************************************/
|
|
|
|
|
/**********************************************************************************
|
|
* *
|
|
* Multiplexing TDO and Tristate control *
|
|
* *
|
|
**********************************************************************************/
|
|
wire TDOShifted;
|
|
assign TDOShifted = (ShiftIR | Exit1IR)? TDOInstruction : TDOData;
|
|
|
|
reg TDOMuxed;
|
|
|
|
|
|
// Tristate control for P_TDO pin
|
|
assign P_TDO = (ShiftIR | ShiftDR | Exit1IR | Exit1DR | UpdateDR)? TDOMuxed : 1'bz;
|
|
|
|
|
|
/**********************************************************************************
|
|
* *
|
|
* End: Multiplexing TDO and Tristate control *
|
|
* *
|
|
**********************************************************************************/
|
|
|
|
|
|
|
|
/**********************************************************************************
|
/**********************************************************************************
|
* *
|
* *
|
Line 1004... |
Line 992... |
end
|
end
|
end
|
end
|
end
|
end
|
|
|
|
|
|
/**********************************************************************************
|
|
* *
|
|
* Multiplexing TDO and Tristate control *
|
|
* *
|
|
**********************************************************************************/
|
|
wire TDOShifted;
|
|
assign TDOShifted = (ShiftIR | Exit1IR)? TDOInstruction : TDOData;
|
|
/**********************************************************************************
|
|
* *
|
|
* End: Multiplexing TDO and Tristate control *
|
|
* *
|
|
**********************************************************************************/
|
|
|
|
|
|
|
// This multiplexing can be expanded with number of user registers
|
// This multiplexing can be expanded with number of user registers
|
|
reg TDOMuxed;
|
always @ (JTAG_IR or TDOShifted or TDOBypassed)
|
always @ (JTAG_IR or TDOShifted or TDOBypassed)
|
begin
|
begin
|
case(JTAG_IR)
|
case(JTAG_IR)
|
`IDCODE: // Reading ID code
|
`IDCODE: // Reading ID code
|
begin
|
begin
|
Line 1020... |
Line 1024... |
end
|
end
|
`DEBUG: // Debug
|
`DEBUG: // Debug
|
begin
|
begin
|
TDOMuxed<=#Tp TDOShifted;
|
TDOMuxed<=#Tp TDOShifted;
|
end
|
end
|
// SAMPLE_PRELOAD: // Sampling/Preloading
|
`SAMPLE_PRELOAD: // Sampling/Preloading
|
// begin
|
begin
|
// TDOMuxed<=#Tp ExitFromBSCell[`BSLength-1];
|
TDOMuxed<=#Tp BS_CHAIN_I;
|
// end
|
end
|
// EXTEST: // External test
|
`EXTEST: // External test
|
// begin
|
begin
|
// TDOMuxed<=#Tp ExitFromBSCell[`BSLength-1];
|
TDOMuxed<=#Tp BS_CHAIN_I;
|
// end
|
end
|
default: // BYPASS instruction
|
default: // BYPASS instruction
|
begin
|
begin
|
TDOMuxed<=#Tp TDOBypassed;
|
TDOMuxed<=#Tp TDOBypassed;
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|
|
|
|
// Tristate control for P_TDO pin
|
|
assign P_TDO = (ShiftIR | ShiftDR | Exit1IR | Exit1DR | UpdateDR)? TDOMuxed : 1'bz;
|
|
|
/**********************************************************************************
|
/**********************************************************************************
|
* *
|
* *
|
* End: Activating Instructions *
|
* End: Activating Instructions *
|
* *
|
* *
|
Line 1078... |
Line 1084... |
* Connecting Registers *
|
* Connecting Registers *
|
* *
|
* *
|
**********************************************************************************/
|
**********************************************************************************/
|
dbg_registers dbgregs(.DataIn(DataOut[31:0]), .DataOut(RegDataIn[31:0]),
|
dbg_registers dbgregs(.DataIn(DataOut[31:0]), .DataOut(RegDataIn[31:0]),
|
.Address(ADDR[4:0]), .RW(RW), .Access(RegAccess & ~RegAccess_q), .Clk(Mclk),
|
.Address(ADDR[4:0]), .RW(RW), .Access(RegAccess & ~RegAccess_q), .Clk(Mclk),
|
.Reset(PowerONReset)
|
.Reset(PowerONReset),
|
`ifdef TRACE_ENABLED
|
`ifdef TRACE_ENABLED
|
,
|
.ContinMode(ContinMode), .TraceEnable(TraceEnable),
|
.ContinMode(ContinMode), .TraceEnable(TraceEnable), .RecSelDepend(RecSelDepend),
|
|
.WpTrigger(WpTrigger), .BpTrigger(BpTrigger), .LSSTrigger(LSSTrigger),
|
.WpTrigger(WpTrigger), .BpTrigger(BpTrigger), .LSSTrigger(LSSTrigger),
|
.ITrigger(ITrigger), .TriggerOper(TriggerOper), .WpQualif(WpQualif),
|
.ITrigger(ITrigger), .TriggerOper(TriggerOper), .WpQualif(WpQualif),
|
.BpQualif(BpQualif), .LSSQualif(LSSQualif), .IQualif(IQualif),
|
.BpQualif(BpQualif), .LSSQualif(LSSQualif), .IQualif(IQualif),
|
.QualifOper(QualifOper), .RecordPC_Wp(RecordPC_Wp),
|
.QualifOper(QualifOper), .RecordPC(RecordPC),
|
.RecordLSEA_Wp(RecordLSEA_Wp), .RecordLDATA_Wp(RecordLDATA_Wp),
|
.RecordLSEA(RecordLSEA), .RecordLDATA(RecordLDATA),
|
.RecordSDATA_Wp(RecordSDATA_Wp), .RecordReadSPR_Wp(RecordReadSPR_Wp),
|
.RecordSDATA(RecordSDATA), .RecordReadSPR(RecordReadSPR),
|
.RecordWriteSPR_Wp(RecordWriteSPR_Wp), .RecordINSTR_Wp(RecordINSTR_Wp),
|
.RecordWriteSPR(RecordWriteSPR), .RecordINSTR(RecordINSTR),
|
.RecordPC_Bp(RecordPC_Bp), .RecordLSEA_Bp(RecordLSEA_Bp),
|
.WpTriggerValid(WpTriggerValid),
|
.RecordLDATA_Bp(RecordLDATA_Bp), .RecordSDATA_Bp(RecordSDATA_Bp),
|
|
.RecordReadSPR_Bp(RecordReadSPR_Bp), .RecordWriteSPR_Bp(RecordWriteSPR_Bp),
|
|
.RecordINSTR_Bp(RecordINSTR_Bp), .WpTriggerValid(WpTriggerValid),
|
|
.BpTriggerValid(BpTriggerValid), .LSSTriggerValid(LSSTriggerValid),
|
.BpTriggerValid(BpTriggerValid), .LSSTriggerValid(LSSTriggerValid),
|
.ITriggerValid(ITriggerValid), .WpQualifValid(WpQualifValid),
|
.ITriggerValid(ITriggerValid), .WpQualifValid(WpQualifValid),
|
.BpQualifValid(BpQualifValid), .LSSQualifValid(LSSQualifValid),
|
.BpQualifValid(BpQualifValid), .LSSQualifValid(LSSQualifValid),
|
.IQualifValid(IQualifValid),
|
.IQualifValid(IQualifValid),
|
.WpStop(WpStop), .BpStop(BpStop), .LSSStop(LSSStop), .IStop(IStop),
|
.WpStop(WpStop), .BpStop(BpStop), .LSSStop(LSSStop), .IStop(IStop),
|
.S topOper(StopOper), .WpStopValid(WpStopValid), .BpStopValid(BpStopValid),
|
.S topOper(StopOper), .WpStopValid(WpStopValid), .BpStopValid(BpStopValid),
|
.LSSStopValid(LSSStopValid), .IStopValid(IStopValid)
|
.LSSStopValid(LSSStopValid), .IStopValid(IStopValid),
|
`endif
|
`endif
|
|
.RiscStall(RiscStall_reg), .RiscReset(RiscReset_reg)
|
|
|
);
|
);
|
|
|
/**********************************************************************************
|
/**********************************************************************************
|
* *
|
* *
|
* End: Connecting Registers *
|
* End: Connecting Registers *
|
Line 1184... |
Line 1188... |
* *
|
* *
|
* Connecting trace module *
|
* Connecting trace module *
|
* *
|
* *
|
**********************************************************************************/
|
**********************************************************************************/
|
`ifdef TRACE_ENABLED
|
`ifdef TRACE_ENABLED
|
dbg_trace dbgTrace1(.Wp(Wp), .Bp(Bp), .DataIn(DataIn), .OpSelect(OpSelect),
|
dbg_trace dbgTrace1(.Wp(Wp), .Bp(Bp), .DataIn(RISC_DATA_IN), .OpSelect(OpSelect),
|
.LsStatus(LsStatus), .IStatus(IStatus), .CpuStall(CpuStall),
|
.LsStatus(LsStatus), .IStatus(IStatus), .RiscStall(RiscStall_trace),
|
.Mclk(Mclk), .Reset(RESET), .TraceChain(TraceChain),
|
.Mclk(Mclk), .Reset(RESET), .TraceChain(TraceChain),
|
.ContinMode(ContinMode), .TraceEnable(TraceEnable),
|
.ContinMode(ContinMode), .TraceEnable(TraceEnable),
|
.RecSelDepend(RecSelDepend), .WpTrigger(WpTrigger),
|
.WpTrigger(WpTrigger),
|
.BpTrigger(BpTrigger), .LSSTrigger(LSSTrigger), .ITrigger(ITrigger),
|
.BpTrigger(BpTrigger), .LSSTrigger(LSSTrigger), .ITrigger(ITrigger),
|
.TriggerOper(TriggerOper), .WpQualif(WpQualif), .BpQualif(BpQualif),
|
.TriggerOper(TriggerOper), .WpQualif(WpQualif), .BpQualif(BpQualif),
|
.LSSQualif(LSSQualif), .IQualif(IQualif), .QualifOper(QualifOper),
|
.LSSQualif(LSSQualif), .IQualif(IQualif), .QualifOper(QualifOper),
|
.RecordPC_Wp(RecordPC_Wp), .RecordLSEA_Wp(RecordLSEA_Wp),
|
.RecordPC(RecordPC), .RecordLSEA(RecordLSEA),
|
.RecordLDATA_Wp(RecordLDATA_Wp), .RecordSDATA_Wp(RecordSDATA_Wp),
|
.RecordLDATA(RecordLDATA), .RecordSDATA(RecordSDATA),
|
.RecordReadSPR_Wp(RecordReadSPR_Wp), .RecordWriteSPR_Wp(RecordWriteSPR_Wp),
|
.RecordReadSPR(RecordReadSPR), .RecordWriteSPR(RecordWriteSPR),
|
.RecordINSTR_Wp(RecordINSTR_Wp), .RecordPC_Bp(RecordPC_Bp),
|
.RecordINSTR(RecordINSTR),
|
.RecordLSEA_Bp(RecordLSEA_Bp), .RecordLDATA_Bp(RecordLDATA_Bp),
|
|
.RecordSDATA_Bp(RecordSDATA_Bp), .RecordReadSPR_Bp(RecordReadSPR_Bp),
|
|
.RecordWriteSPR_Bp(RecordWriteSPR_Bp), .RecordINSTR_Bp(RecordINSTR_Bp),
|
|
.WpTriggerValid(WpTriggerValid), .BpTriggerValid(BpTriggerValid),
|
.WpTriggerValid(WpTriggerValid), .BpTriggerValid(BpTriggerValid),
|
.LSSTriggerValid(LSSTriggerValid), .ITriggerValid(ITriggerValid),
|
.LSSTriggerValid(LSSTriggerValid), .ITriggerValid(ITriggerValid),
|
.WpQualifValid(WpQualifValid), .BpQualifValid(BpQualifValid),
|
.WpQualifValid(WpQualifValid), .BpQualifValid(BpQualifValid),
|
.LSSQualifValid(LSSQualifValid), .IQualifValid(IQualifValid),
|
.LSSQualifValid(LSSQualifValid), .IQualifValid(IQualifValid),
|
.ReadBuffer(ReadBuffer_Mclk),
|
.ReadBuffer(ReadBuffer_Mclk),
|