Line 29... |
Line 29... |
//
|
//
|
// *Author(s):
|
// *Author(s):
|
// - Olivier Girard, olgirard@gmail.com
|
// - Olivier Girard, olgirard@gmail.com
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
// $Rev: 104 $
|
// $Rev: 111 $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedDate: 2011-03-06 21:02:27 +0100 (Sun, 06 Mar 2011) $
|
// $LastChangedDate: 2011-05-20 22:39:02 +0200 (Fri, 20 May 2011) $
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
`ifdef OMSP_NO_INCLUDE
|
`ifdef OMSP_NO_INCLUDE
|
`else
|
`else
|
`include "openMSP430_defines.v"
|
`include "openMSP430_defines.v"
|
`endif
|
`endif
|
Line 51... |
Line 51... |
inst_pc, // Instruction Program counter
|
inst_pc, // Instruction Program counter
|
inst_short, // Currently executed instruction (short version)
|
inst_short, // Currently executed instruction (short version)
|
|
|
// INPUTs
|
// INPUTs
|
mclk, // Main system clock
|
mclk, // Main system clock
|
puc // Main system reset
|
puc_rst // Main system reset
|
);
|
);
|
|
|
// OUTPUTs
|
// OUTPUTs
|
//============
|
//============
|
output [8*32-1:0] e_state; // Execution state
|
output [8*32-1:0] e_state; // Execution state
|
Line 67... |
Line 67... |
output [8*32-1:0] inst_short; // Currently executed instruction (short version)
|
output [8*32-1:0] inst_short; // Currently executed instruction (short version)
|
|
|
// INPUTs
|
// INPUTs
|
//============
|
//============
|
input mclk; // Main system clock
|
input mclk; // Main system clock
|
input puc; // Main system reset
|
input puc_rst; // Main system reset
|
|
|
|
|
//=============================================================================
|
//=============================================================================
|
// 1) ASCII FORMATING FUNCTIONS
|
// 1) ASCII FORMATING FUNCTIONS
|
//=============================================================================
|
//=============================================================================
|
Line 169... |
Line 169... |
|
|
// Count instruction number & cycles
|
// Count instruction number & cycles
|
//====================================
|
//====================================
|
|
|
reg [31:0] inst_number;
|
reg [31:0] inst_number;
|
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc_rst)
|
if (puc) inst_number <= 0;
|
if (puc_rst) inst_number <= 0;
|
else if (decode) inst_number <= inst_number+1;
|
else if (decode) inst_number <= inst_number+1;
|
|
|
reg [31:0] inst_cycle;
|
reg [31:0] inst_cycle;
|
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc_rst)
|
if (puc) inst_cycle <= 0;
|
if (puc_rst) inst_cycle <= 0;
|
else if (decode) inst_cycle <= 0;
|
else if (decode) inst_cycle <= 0;
|
else inst_cycle <= inst_cycle+1;
|
else inst_cycle <= inst_cycle+1;
|
|
|
|
|
// Decode instruction
|
// Decode instruction
|
//====================================
|
//====================================
|
|
|
// Buffer opcode
|
// Buffer opcode
|
reg [15:0] opcode;
|
reg [15:0] opcode;
|
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc_rst)
|
if (puc) opcode <= 0;
|
if (puc_rst) opcode <= 0;
|
else if (decode) opcode <= ir;
|
else if (decode) opcode <= ir;
|
|
|
// Interrupts
|
// Interrupts
|
reg irq;
|
reg irq;
|
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc_rst)
|
if (puc) irq <= 1'b1;
|
if (puc_rst) irq <= 1'b1;
|
else if (decode) irq <= irq_detect;
|
else if (decode) irq <= irq_detect;
|
|
|
// Instruction type
|
// Instruction type
|
reg [8*32-1:0] inst_type;
|
reg [8*32-1:0] inst_type;
|
always @(opcode or irq)
|
always @(opcode or irq)
|
Line 436... |
Line 436... |
|
|
// Instruction program counter
|
// Instruction program counter
|
//================================
|
//================================
|
|
|
reg [15:0] inst_pc;
|
reg [15:0] inst_pc;
|
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc_rst)
|
if (puc) inst_pc <= 16'h0000;
|
if (puc_rst) inst_pc <= 16'h0000;
|
else if (decode) inst_pc <= pc;
|
else if (decode) inst_pc <= pc;
|
|
|
|
|
endmodule // msp_debug
|
endmodule // msp_debug
|
|
|