Line 18... |
Line 18... |
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
***********************************************************************************/
|
***********************************************************************************/
|
|
|
|
//`define DEBUG_TO_STDOUT 1
|
|
|
|
`ifdef DEBUG_TO_STDOUT
|
|
`define DWRITE $write(
|
|
`else
|
|
`define DWRITE $fwrite(CP_LOG,
|
|
`endif
|
|
|
|
|
module ContolCode_Dumper;
|
module ContolCode_Dumper;
|
//wait( `CP_TOP.Reset == 0 );
|
//wait( `CP_TOP.Reset == 0 );
|
|
integer CP_LOG;
|
|
reg [255:1] CPLogFileName;
|
|
|
|
|
|
initial
|
|
begin
|
|
//Open output file
|
|
|
|
CP_LOG = $fopen("cp.log");
|
|
end
|
|
|
|
|
|
|
|
|
|
|
always @ ( posedge `CP_TOP.Clock )
|
always @ ( posedge `CP_TOP.Clock )
|
begin
|
begin
|
|
|
case (`CP_TOP.wOperation)
|
case (`CP_TOP.wOperation)
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_COPYBLOCK:
|
`CONTROL_PROCESSOR_OP_COPYBLOCK:
|
begin
|
begin
|
$write("\n%dns CP: COPYBLOCK DSTID: %d BLKLEN: %d TAG: %d DSTOFF: %h SRCOFF: %h\n\n",$time,
|
`DWRITE"\n%dns CP: COPYBLOCK DSTID: %d BLKLEN: %d TAG: %d DSTOFF: %h SRCOFF: %h\n\n",$time,
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_VPMASK_RNG],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_VPMASK_RNG],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_BLKLEN_RNG],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_BLKLEN_RNG],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCK_TAG_BIT],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCK_TAG_BIT],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_DSTOFF_RNG],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_DSTOFF_RNG],
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_SRCOFF_RNG]);
|
`CP_TOP.oCopyBlockCommand[`MCU_COPYMEMBLOCKCMD_SRCOFF_RNG]);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_DELIVER_COMMAND:
|
`CONTROL_PROCESSOR_OP_DELIVER_COMMAND:
|
begin
|
begin
|
$write("%dns CP: DELIVER_COMMAND VP[%d] ",$time,
|
`DWRITE"%dns CP: DELIVER_COMMAND VP[%d] ",$time,
|
`CP_TOP.wDestination);
|
`CP_TOP.wDestination);
|
|
|
case (`CP_TOP.wSourceAddr1)
|
case (`CP_TOP.wSourceAddr1)
|
`VP_COMMAND_START_MAIN_THREAD: $write( " START_MAIN_THREAD ");
|
`VP_COMMAND_START_MAIN_THREAD: `DWRITE " START_MAIN_THREAD ");
|
`VP_COMMAND_STOP_MAIN_THREAD: $write( " STOP_MAIN_THREAD ");
|
`VP_COMMAND_STOP_MAIN_THREAD: `DWRITE " STOP_MAIN_THREAD ");
|
endcase
|
endcase
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_NOP:
|
`CONTROL_PROCESSOR_OP_NOP:
|
begin
|
begin
|
$write("%dns CP: NOP\n",$time);
|
`DWRITE"%dns CP: NOP\n",$time);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_EXIT:
|
`CONTROL_PROCESSOR_OP_EXIT:
|
begin
|
begin
|
$write("%dns CP: EXIT\n",$time);
|
`DWRITE"%dns CP: EXIT\n",$time);
|
//$stop;
|
//$stop;
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_ADD:
|
`CONTROL_PROCESSOR_OP_ADD:
|
begin
|
begin
|
|
|
if (`CP_TOP.rWriteEnable)
|
if (`CP_TOP.rWriteEnable)
|
$write("%dns CP: ADD R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
`DWRITE"%dns CP: ADD R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_SUB:
|
`CONTROL_PROCESSOR_OP_SUB:
|
begin
|
begin
|
$write("%dns CP: SUB R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
`DWRITE"%dns CP: SUB R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_AND:
|
`CONTROL_PROCESSOR_OP_AND:
|
begin
|
begin
|
$write("%dns CP: AND R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
`DWRITE"%dns CP: AND R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_OR:
|
`CONTROL_PROCESSOR_OP_OR:
|
begin
|
begin
|
$write("%dns CP: OR R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
`DWRITE"%dns CP: OR R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_SHL:
|
`CONTROL_PROCESSOR_OP_SHL:
|
begin
|
begin
|
$write("%dns CP: SHL R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
`DWRITE"%dns CP: SHL R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_SHR:
|
`CONTROL_PROCESSOR_OP_SHR:
|
begin
|
begin
|
$write("%dns CP: SHR R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
`DWRITE"%dns CP: SHR R[%d] R[%d]{%h} R[%d]{%h} = %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0,`CP_TOP.rResult);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BLE:
|
`CONTROL_PROCESSOR_OP_BLE:
|
begin
|
begin
|
$write("%dns CP: BLE\n",$time);
|
`DWRITE"%dns CP: BLE\n",$time);
|
|
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BL:
|
`CONTROL_PROCESSOR_OP_BL:
|
begin
|
begin
|
$write("%dns CP: BL\n",$time);
|
`DWRITE"%dns CP: BL\n",$time);
|
|
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BG:
|
`CONTROL_PROCESSOR_OP_BG:
|
begin
|
begin
|
$write("%dns CP: BG\n",$time);
|
`DWRITE"%dns CP: BG\n",$time);
|
|
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BGE:
|
`CONTROL_PROCESSOR_OP_BGE:
|
begin
|
begin
|
$write("%dns CP: BGE\n",$time);
|
`DWRITE"%dns CP: BGE\n",$time);
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BEQ:
|
`CONTROL_PROCESSOR_OP_BEQ:
|
begin
|
begin
|
$write("%dns CP: BEQ %d, R[%d] {%h} R[%d] {%h}\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0);
|
`DWRITE"%dns CP: BEQ %d, R[%d] {%h} R[%d] {%h}\n",$time,`CP_TOP.wDestination,`CP_TOP.wSourceAddr1,`CP_TOP.wSourceData1,`CP_TOP.wSourceAddr0,`CP_TOP.wSourceData0);
|
|
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BNE:
|
`CONTROL_PROCESSOR_OP_BNE:
|
begin
|
begin
|
$write("%dns CP: BNE\n",$time);
|
`DWRITE"%dns CP: BNE\n",$time);
|
|
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_OP_BRANCH:
|
`CONTROL_PROCESSOR_OP_BRANCH:
|
begin
|
begin
|
$write("%dns CP: BRANCH %h\n",$time,`CP_TOP.wDestination );
|
`DWRITE"%dns CP: BRANCH %h\n",$time,`CP_TOP.wDestination );
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
`CONTROL_PROCESSOR_ASSIGN:
|
`CONTROL_PROCESSOR_ASSIGN:
|
begin
|
begin
|
$write("%dns CP: ASSIGN R[%d] I(%h)= %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wImmediateValue,`CP_TOP.rResult);
|
`DWRITE"%dns CP: ASSIGN R[%d] I(%h)= %h\n",$time,`CP_TOP.wDestination,`CP_TOP.wImmediateValue,`CP_TOP.rResult);
|
|
|
end
|
end
|
//-------------------------------------
|
//-------------------------------------
|
default:
|
default:
|
begin
|
begin
|