OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [rtl/] [verilog/] [omsp_dbg_hwbrk.v] - Diff between revs 103 and 106

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 103 Rev 106
Line 29... Line 29...
//
//
// *Author(s):
// *Author(s):
//              - Olivier Girard,    olgirard@gmail.com
//              - Olivier Girard,    olgirard@gmail.com
//
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// $Rev: 103 $
// $Rev: 106 $
// $LastChangedBy: olivier.girard $
// $LastChangedBy: olivier.girard $
// $LastChangedDate: 2011-03-05 15:44:48 +0100 (Sat, 05 Mar 2011) $
// $LastChangedDate: 2011-03-25 23:01:03 +0100 (Fri, 25 Mar 2011) $
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
`ifdef OMSP_NO_INCLUDE
`ifdef OMSP_NO_INCLUDE
`else
`else
`include "openMSP430_defines.v"
`include "openMSP430_defines.v"
`endif
`endif
Line 48... Line 48...
    brk_dout,                // Hardware break/watch-point register data input
    brk_dout,                // Hardware break/watch-point register data input
 
 
// INPUTs
// INPUTs
    brk_reg_rd,              // Hardware break/watch-point register read select
    brk_reg_rd,              // Hardware break/watch-point register read select
    brk_reg_wr,              // Hardware break/watch-point register write select
    brk_reg_wr,              // Hardware break/watch-point register write select
 
    dbg_clk,                 // Debug unit clock
    dbg_din,                 // Debug register data input
    dbg_din,                 // Debug register data input
 
    dbg_rst,                 // Debug unit reset
    eu_mab,                  // Execution-Unit Memory address bus
    eu_mab,                  // Execution-Unit Memory address bus
    eu_mb_en,                // Execution-Unit Memory bus enable
    eu_mb_en,                // Execution-Unit Memory bus enable
    eu_mb_wr,                // Execution-Unit Memory bus write transfer
    eu_mb_wr,                // Execution-Unit Memory bus write transfer
    eu_mdb_in,               // Memory data bus input
    eu_mdb_in,               // Memory data bus input
    eu_mdb_out,              // Memory data bus output
    eu_mdb_out,              // Memory data bus output
    exec_done,               // Execution completed
    exec_done,               // Execution completed
    fe_mb_en,                // Frontend Memory bus enable
    fe_mb_en,                // Frontend Memory bus enable
    mclk,                    // Main system clock
    pc                       // Program counter
    pc,                      // Program counter
 
    por                      // Power on reset
 
);
);
 
 
// OUTPUTs
// OUTPUTs
//=========
//=========
output         brk_halt;     // Hardware breakpoint command
output         brk_halt;     // Hardware breakpoint command
Line 71... Line 71...
 
 
// INPUTs
// INPUTs
//=========
//=========
input    [3:0] brk_reg_rd;   // Hardware break/watch-point register read select
input    [3:0] brk_reg_rd;   // Hardware break/watch-point register read select
input    [3:0] brk_reg_wr;   // Hardware break/watch-point register write select
input    [3:0] brk_reg_wr;   // Hardware break/watch-point register write select
 
input          dbg_clk;      // Debug unit clock
input   [15:0] dbg_din;      // Debug register data input
input   [15:0] dbg_din;      // Debug register data input
 
input          dbg_rst;      // Debug unit reset
input   [15:0] eu_mab;       // Execution-Unit Memory address bus
input   [15:0] eu_mab;       // Execution-Unit Memory address bus
input          eu_mb_en;     // Execution-Unit Memory bus enable
input          eu_mb_en;     // Execution-Unit Memory bus enable
input    [1:0] eu_mb_wr;     // Execution-Unit Memory bus write transfer
input    [1:0] eu_mb_wr;     // Execution-Unit Memory bus write transfer
input   [15:0] eu_mdb_in;    // Memory data bus input
input   [15:0] eu_mdb_in;    // Memory data bus input
input   [15:0] eu_mdb_out;   // Memory data bus output
input   [15:0] eu_mdb_out;   // Memory data bus output
input          exec_done;    // Execution completed
input          exec_done;    // Execution completed
input          fe_mb_en;     // Frontend Memory bus enable
input          fe_mb_en;     // Frontend Memory bus enable
input          mclk;         // Main system clock
 
input   [15:0] pc;           // Program counter
input   [15:0] pc;           // Program counter
input          por;          // Power on reset
 
 
 
 
 
//=============================================================================
//=============================================================================
// 1)  WIRE & PARAMETER DECLARATION
// 1)  WIRE & PARAMETER DECLARATION
//=============================================================================
//=============================================================================
Line 131... Line 131...
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
reg   [4:0] brk_ctl;
reg   [4:0] brk_ctl;
 
 
wire        brk_ctl_wr = brk_reg_wr[BRK_CTL];
wire        brk_ctl_wr = brk_reg_wr[BRK_CTL];
 
 
always @ (posedge mclk or posedge por)
always @ (posedge dbg_clk or posedge dbg_rst)
  if (por)             brk_ctl <=  5'h00;
  if (dbg_rst)         brk_ctl <=  5'h00;
  else if (brk_ctl_wr) brk_ctl <=  {`HWBRK_RANGE & dbg_din[4], dbg_din[3:0]};
  else if (brk_ctl_wr) brk_ctl <=  {`HWBRK_RANGE & dbg_din[4], dbg_din[3:0]};
 
 
wire  [7:0] brk_ctl_full = {3'b000, brk_ctl};
wire  [7:0] brk_ctl_full = {3'b000, brk_ctl};
 
 
 
 
Line 152... Line 152...
                            range_rd_set & `HWBRK_RANGE,
                            range_rd_set & `HWBRK_RANGE,
                            addr1_wr_set, addr1_rd_set,
                            addr1_wr_set, addr1_rd_set,
                            addr0_wr_set, addr0_rd_set};
                            addr0_wr_set, addr0_rd_set};
wire  [5:0] brk_stat_clr = ~dbg_din[5:0];
wire  [5:0] brk_stat_clr = ~dbg_din[5:0];
 
 
always @ (posedge mclk or posedge por)
always @ (posedge dbg_clk or posedge dbg_rst)
  if (por)              brk_stat <=  6'h00;
  if (dbg_rst)          brk_stat <=  6'h00;
  else if (brk_stat_wr) brk_stat <= ((brk_stat & brk_stat_clr) | brk_stat_set);
  else if (brk_stat_wr) brk_stat <= ((brk_stat & brk_stat_clr) | brk_stat_set);
  else                  brk_stat <=  (brk_stat                 | brk_stat_set);
  else                  brk_stat <=  (brk_stat                 | brk_stat_set);
 
 
wire  [7:0] brk_stat_full = {2'b00, brk_stat};
wire  [7:0] brk_stat_full = {2'b00, brk_stat};
wire        brk_pnd       = |brk_stat;
wire        brk_pnd       = |brk_stat;
Line 167... Line 167...
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
reg  [15:0] brk_addr0;
reg  [15:0] brk_addr0;
 
 
wire        brk_addr0_wr = brk_reg_wr[BRK_ADDR0];
wire        brk_addr0_wr = brk_reg_wr[BRK_ADDR0];
 
 
always @ (posedge mclk or posedge por)
always @ (posedge dbg_clk or posedge dbg_rst)
  if (por)               brk_addr0 <=  16'h0000;
  if (dbg_rst)           brk_addr0 <=  16'h0000;
  else if (brk_addr0_wr) brk_addr0 <=  dbg_din;
  else if (brk_addr0_wr) brk_addr0 <=  dbg_din;
 
 
 
 
// BRK_ADDR1/DATA0 Register
// BRK_ADDR1/DATA0 Register
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
reg  [15:0] brk_addr1;
reg  [15:0] brk_addr1;
 
 
wire        brk_addr1_wr = brk_reg_wr[BRK_ADDR1];
wire        brk_addr1_wr = brk_reg_wr[BRK_ADDR1];
 
 
always @ (posedge mclk or posedge por)
always @ (posedge dbg_clk or posedge dbg_rst)
  if (por)               brk_addr1 <=  16'h0000;
  if (dbg_rst)           brk_addr1 <=  16'h0000;
  else if (brk_addr1_wr) brk_addr1 <=  dbg_din;
  else if (brk_addr1_wr) brk_addr1 <=  dbg_din;
 
 
 
 
//============================================================================
//============================================================================
// 3) DATA OUTPUT GENERATION
// 3) DATA OUTPUT GENERATION
Line 213... Line 213...
wire        equ_d_addr1 = eu_mb_en & (eu_mab==brk_addr1) & ~brk_ctl[`BRK_RANGE];
wire        equ_d_addr1 = eu_mb_en & (eu_mab==brk_addr1) & ~brk_ctl[`BRK_RANGE];
wire        equ_d_range = eu_mb_en & ((eu_mab>=brk_addr0) & (eu_mab<=brk_addr1)) &
wire        equ_d_range = eu_mb_en & ((eu_mab>=brk_addr0) & (eu_mab<=brk_addr1)) &
                          brk_ctl[`BRK_RANGE] & `HWBRK_RANGE;
                          brk_ctl[`BRK_RANGE] & `HWBRK_RANGE;
 
 
reg         fe_mb_en_buf;
reg         fe_mb_en_buf;
always @ (posedge mclk or posedge por)
always @ (posedge dbg_clk or posedge dbg_rst)
  if (por)  fe_mb_en_buf <=  1'b0;
  if (dbg_rst)  fe_mb_en_buf <=  1'b0;
  else      fe_mb_en_buf <=  fe_mb_en;
  else      fe_mb_en_buf <=  fe_mb_en;
 
 
wire        equ_i_addr0 = fe_mb_en_buf & (pc==brk_addr0) & ~brk_ctl[`BRK_RANGE];
wire        equ_i_addr0 = fe_mb_en_buf & (pc==brk_addr0) & ~brk_ctl[`BRK_RANGE];
wire        equ_i_addr1 = fe_mb_en_buf & (pc==brk_addr1) & ~brk_ctl[`BRK_RANGE];
wire        equ_i_addr1 = fe_mb_en_buf & (pc==brk_addr1) & ~brk_ctl[`BRK_RANGE];
wire        equ_i_range = fe_mb_en_buf & ((pc>=brk_addr0) & (pc<=brk_addr1)) &
wire        equ_i_range = fe_mb_en_buf & ((pc>=brk_addr0) & (pc<=brk_addr1)) &
Line 242... Line 242...
// Whenever an "ADD r9. &0x200" instruction is executed, &0x200 will be read
// Whenever an "ADD r9. &0x200" instruction is executed, &0x200 will be read
// before being written back. In that case, the read flag should not be set.
// before being written back. In that case, the read flag should not be set.
// In general, We should here make sure no write access occures during the
// In general, We should here make sure no write access occures during the
// same instruction cycle before setting the read flag.
// same instruction cycle before setting the read flag.
reg [2:0] d_rd_trig;
reg [2:0] d_rd_trig;
always @ (posedge mclk or posedge por)
always @ (posedge dbg_clk or posedge dbg_rst)
  if (por)            d_rd_trig <=  3'h0;
  if (dbg_rst)        d_rd_trig <=  3'h0;
  else if (exec_done) d_rd_trig <=  3'h0;
  else if (exec_done) d_rd_trig <=  3'h0;
  else                d_rd_trig <=  {equ_d_range & ~brk_ctl[`BRK_I_EN] & ~|eu_mb_wr,
  else                d_rd_trig <=  {equ_d_range & ~brk_ctl[`BRK_I_EN] & ~|eu_mb_wr,
                                     equ_d_addr1 & ~brk_ctl[`BRK_I_EN] & ~|eu_mb_wr,
                                     equ_d_addr1 & ~brk_ctl[`BRK_I_EN] & ~|eu_mb_wr,
                                     equ_d_addr0 & ~brk_ctl[`BRK_I_EN] & ~|eu_mb_wr};
                                     equ_d_addr0 & ~brk_ctl[`BRK_I_EN] & ~|eu_mb_wr};
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.