Line 29... |
Line 29... |
//
|
//
|
// *Author(s):
|
// *Author(s):
|
// - Olivier Girard, olgirard@gmail.com
|
// - Olivier Girard, olgirard@gmail.com
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
// $Rev: 37 $
|
// $Rev: 54 $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedDate: 2009-12-29 21:58:14 +0100 (Tue, 29 Dec 2009) $
|
// $LastChangedDate: 2010-01-27 19:25:43 +0100 (Wed, 27 Jan 2010) $
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
`include "timescale.v"
|
`include "timescale.v"
|
`include "openMSP430_defines.v"
|
`include "openMSP430_defines.v"
|
|
|
module omsp_frontend (
|
module omsp_frontend (
|
|
|
// OUTPUTs
|
// OUTPUTs
|
dbg_halt_st, // Halt/Run status from CPU
|
dbg_halt_st, // Halt/Run status from CPU
|
decode, // Frontend decode instruction
|
decode_noirq, // Frontend decode instruction
|
e_state, // Execution state
|
e_state, // Execution state
|
exec_done, // Execution completed
|
exec_done, // Execution completed
|
inst_ad, // Decoded Inst: destination addressing mode
|
inst_ad, // Decoded Inst: destination addressing mode
|
inst_as, // Decoded Inst: source addressing mode
|
inst_as, // Decoded Inst: source addressing mode
|
inst_alu, // ALU control signals
|
inst_alu, // ALU control signals
|
Line 81... |
Line 81... |
);
|
);
|
|
|
// OUTPUTs
|
// OUTPUTs
|
//=========
|
//=========
|
output dbg_halt_st; // Halt/Run status from CPU
|
output dbg_halt_st; // Halt/Run status from CPU
|
output decode; // Frontend decode instruction
|
output decode_noirq; // Frontend decode instruction
|
output [3:0] e_state; // Execution state
|
output [3:0] e_state; // Execution state
|
output exec_done; // Execution completed
|
output exec_done; // Execution completed
|
output [7:0] inst_ad; // Decoded Inst: destination addressing mode
|
output [7:0] inst_ad; // Decoded Inst: destination addressing mode
|
output [7:0] inst_as; // Decoded Inst: source addressing mode
|
output [7:0] inst_as; // Decoded Inst: source addressing mode
|
output [11:0] inst_alu; // ALU control signals
|
output [11:0] inst_alu; // ALU control signals
|
Line 171... |
Line 171... |
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc)
|
if (puc) i_state <= I_IRQ_FETCH;
|
if (puc) i_state <= I_IRQ_FETCH;
|
else i_state <= i_state_nxt;
|
else i_state <= i_state_nxt;
|
|
|
// Utility signals
|
// Utility signals
|
wire decode = ((i_state==I_DEC) & (exec_done | (e_state==`E_IDLE))) | irq_detect;
|
wire decode_noirq = ((i_state==I_DEC) & (exec_done | (e_state==`E_IDLE)));
|
|
wire decode = decode_noirq | irq_detect;
|
wire fetch = ~((i_state==I_DEC) & ~(exec_done | (e_state==`E_IDLE))) & ~(e_state_nxt==`E_IDLE);
|
wire fetch = ~((i_state==I_DEC) & ~(exec_done | (e_state==`E_IDLE))) & ~(e_state_nxt==`E_IDLE);
|
|
|
// Debug interface cpu status
|
// Debug interface cpu status
|
reg dbg_halt_st;
|
reg dbg_halt_st;
|
always @(posedge mclk or posedge puc)
|
always @(posedge mclk or posedge puc)
|