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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [asyst_2/] [rtl/] [verilog/] [dbg_cpu_registers.v] - Diff between revs 138 and 139

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

Rev 138 Rev 139
Line 1... Line 1...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
////  dbg_cpu_registers.v                                         ////
////  dbg_cpu_registers.v                                         ////
////                                                              ////
////                                                              ////
////                                                              ////
////                                                              ////
////  This file is part of the SoC/OpenRISC Development Interface ////
////  This file is part of the SoC Debug Interface.               ////
////  http://www.opencores.org/projects/DebugInterface/           ////
////  http://www.opencores.org/projects/DebugInterface/           ////
////                                                              ////
////                                                              ////
////  Author(s):                                                  ////
////  Author(s):                                                  ////
////       Igor Mohor (igorm@opencores.org)                       ////
////       Igor Mohor (igorm@opencores.org)                       ////
////                                                              ////
////                                                              ////
Line 41... Line 41...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.5  2004/03/22 16:35:46  igorm
 
// Temp version before changing dbg interface.
 
//
// Revision 1.4  2004/01/25 14:04:18  mohor
// Revision 1.4  2004/01/25 14:04:18  mohor
// All flipflops are reset.
// All flipflops are reset.
//
//
// Revision 1.3  2004/01/22 10:16:08  mohor
// Revision 1.3  2004/01/22 10:16:08  mohor
// cpu_stall_o activated as soon as bp occurs.
// cpu_stall_o activated as soon as bp occurs.
Line 63... Line 66...
// synopsys translate_on
// synopsys translate_on
`include "dbg_cpu_defines.v"
`include "dbg_cpu_defines.v"
 
 
module dbg_cpu_registers  (
module dbg_cpu_registers  (
                            data_i,
                            data_i,
                            data_o,
 
                            addr_i,
 
                            we_i,
                            we_i,
                            en_i,
                            tck_i,
                            clk_i,
 
                            bp_i,
                            bp_i,
                            rst_i,
                            rst_i,
                            cpu_clk_i,
                            cpu_clk_i,
 
                            ctrl_reg_o,
                            cpu_stall_o,
                            cpu_stall_o,
                            cpu_stall_all_o,
 
                            cpu_sel_o,
 
                            cpu_rst_o
                            cpu_rst_o
                          );
                          );
 
 
 
 
input            [7:0]  data_i;
input  [`DBG_CPU_CTRL_LEN -1:0] data_i;
input            [1:0]  addr_i;
 
 
 
input                   we_i;
input                   we_i;
input                   en_i;
input                   tck_i;
input                   clk_i;
 
input                   bp_i;
input                   bp_i;
input                   rst_i;
input                   rst_i;
input                   cpu_clk_i;
input                   cpu_clk_i;
 
 
output           [7:0]  data_o;
output [`DBG_CPU_CTRL_LEN -1:0]ctrl_reg_o;
reg              [7:0]  data_o;
 
 
 
output                  cpu_stall_o;
output                  cpu_stall_o;
output                  cpu_stall_all_o;
 
output [`CPU_NUM -1:0]  cpu_sel_o;
 
output                  cpu_rst_o;
output                  cpu_rst_o;
 
 
wire                    cpu_stall_all;
reg                     cpu_reset;
wire                    cpu_reset;
 
wire             [2:1]  cpu_op_out;
wire             [2:1]  cpu_op_out;
wire   [`CPU_NUM -1:0]  cpu_sel_out;
 
 
 
wire                    cpuop_wr;
reg                     stall_bp, stall_bp_csff, stall_bp_tck;
wire                    cpusel_wr;
reg                     stall_reg, stall_reg_csff, stall_reg_cpu;
 
reg                     cpu_reset_csff;
reg                     cpusel_wr_sync, cpusel_wr_cpu;
 
reg                     stall_bp, stall_bp_sync, stall_bp_tck;
 
reg                     stall_reg, stall_reg_sync, stall_reg_cpu;
 
reg                     cpu_stall_all_sync;
 
reg                     cpu_stall_all_o;
 
reg                     cpu_reset_sync;
 
reg                     cpu_rst_o;
reg                     cpu_rst_o;
 
 
 
 
 
 
assign cpuop_wr      = en_i & we_i & (addr_i == `CPU_OP_ADR);
 
assign cpusel_wr     = en_i & we_i & (addr_i == `CPU_SEL_ADR);
 
 
 
 
 
// Synchronising we for cpu_sel register that works in cpu_clk clock domain
 
always @ (posedge cpu_clk_i or posedge rst_i)
 
begin
 
  if (rst_i)
 
    begin
 
      cpusel_wr_sync <= #1 1'b0;
 
      cpusel_wr_cpu  <= #1 1'b0;
 
    end
 
  else
 
    begin
 
      cpusel_wr_sync <= #1 cpusel_wr;
 
      cpusel_wr_cpu  <= #1 cpusel_wr_sync;
 
    end
 
end
 
 
 
 
 
// Breakpoint is latched and synchronized. Stall is set and latched.
// Breakpoint is latched and synchronized. Stall is set and latched.
always @ (posedge cpu_clk_i or posedge rst_i)
always @ (posedge cpu_clk_i or posedge rst_i)
begin
begin
  if(rst_i)
  if(rst_i)
    stall_bp <= #1 1'b0;
    stall_bp <= #1 1'b0;
Line 147... Line 111...
    stall_bp <= #1 1'b0;
    stall_bp <= #1 1'b0;
end
end
 
 
 
 
// Synchronizing
// Synchronizing
always @ (posedge clk_i or posedge rst_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (rst_i)
  if (rst_i)
    begin
    begin
      stall_bp_sync <= #1 1'b0;
      stall_bp_csff <= #1 1'b0;
      stall_bp_tck  <= #1 1'b0;
      stall_bp_tck  <= #1 1'b0;
    end
    end
  else
  else
    begin
    begin
      stall_bp_sync <= #1 stall_bp;
      stall_bp_csff <= #1 stall_bp;
      stall_bp_tck  <= #1 stall_bp_sync;
      stall_bp_tck  <= #1 stall_bp_csff;
    end
    end
end
end
 
 
 
 
always @ (posedge clk_i or posedge rst_i)
 
begin
 
  if (rst_i)
 
    stall_reg <= #1 1'b0;
 
  else if (stall_bp_tck)
 
    stall_reg <= #1 1'b1;
 
  else if (cpuop_wr)
 
    stall_reg <= #1 data_i[0];
 
end
 
 
 
 
 
always @ (posedge cpu_clk_i or posedge rst_i)
always @ (posedge cpu_clk_i or posedge rst_i)
begin
begin
  if (rst_i)
  if (rst_i)
    begin
    begin
      stall_reg_sync <= #1 1'b0;
      stall_reg_csff <= #1 1'b0;
      stall_reg_cpu  <= #1 1'b0;
      stall_reg_cpu  <= #1 1'b0;
    end
    end
  else
  else
    begin
    begin
      stall_reg_sync <= #1 stall_reg;
      stall_reg_csff <= #1 stall_reg;
      stall_reg_cpu  <= #1 stall_reg_sync;
      stall_reg_cpu  <= #1 stall_reg_csff;
    end
    end
end
end
 
 
 
 
assign cpu_stall_o = bp_i | stall_bp | stall_reg_cpu;
assign cpu_stall_o = bp_i | stall_bp | stall_reg_cpu;
 
 
 
 
 
// Writing data to the control registers (stall)
dbg_register #(2, 0)          CPUOP  (.data_in(data_i[2:1]),           .data_out(cpu_op_out[2:1]), .write(cpuop_wr),       .clk(clk_i),     .reset(rst_i));
always @ (posedge tck_i or posedge rst_i)
dbg_register #(`CPU_NUM, `CPU_NUM'h1)   CPUSEL (.data_in(data_i[`CPU_NUM-1:0]),  .data_out(cpu_sel_out),     .write(cpusel_wr_cpu),  .clk(cpu_clk_i), .reset(rst_i)); // cpu_cli_i
 
 
 
 
 
always @ (posedge clk_i or posedge rst_i)
 
begin
begin
  if (rst_i)
  if (rst_i)
    data_o <= #1 8'h0;
    stall_reg <= #1 1'b0;
  else
  else if (stall_bp_tck)
    begin
    stall_reg <= #1 1'b1;
      case (addr_i)         // Synthesis parallel_case
  else if (we_i)
        `CPU_OP_ADR  : data_o <= #1 {5'h0, cpu_op_out[2:1], stall_reg};
    stall_reg <= #1 data_i[0];
        `CPU_SEL_ADR : data_o <= #1 {{(8-`CPU_NUM){1'b0}}, cpu_sel_out};
 
        default      : data_o <= #1 8'h0;
 
      endcase
 
    end
 
end
end
 
 
 
 
assign cpu_stall_all      = cpu_op_out[2];       // this signal is used to stall all the cpus except the one that is selected in cpusel register
// Writing data to the control registers (reset)
assign cpu_sel_o          = cpu_sel_out;
always @ (posedge tck_i or posedge rst_i)
assign cpu_reset          = cpu_op_out[1];
begin
 
  if (rst_i)
 
    cpu_reset  <= #1 1'b0;
 
  else if(we_i)
 
    cpu_reset  <= #1 data_i[1];
 
end
 
 
 
 
// Synchronizing signals from registers
// Synchronizing signals from registers
always @ (posedge cpu_clk_i or posedge rst_i)
always @ (posedge cpu_clk_i or posedge rst_i)
begin
begin
  if (rst_i)
  if (rst_i)
    begin
    begin
      cpu_stall_all_sync  <= #1 1'b0;
      cpu_reset_csff      <= #1 1'b0;
      cpu_stall_all_o     <= #1 1'b0;
 
      cpu_reset_sync      <= #1 1'b0;
 
      cpu_rst_o           <= #1 1'b0;
      cpu_rst_o           <= #1 1'b0;
    end
    end
  else
  else
    begin
    begin
      cpu_stall_all_sync  <= #1 cpu_stall_all;
      cpu_reset_csff      <= #1 cpu_reset;
      cpu_stall_all_o     <= #1 cpu_stall_all_sync;
      cpu_rst_o           <= #1 cpu_reset_csff;
      cpu_reset_sync      <= #1 cpu_reset;
 
      cpu_rst_o           <= #1 cpu_reset_sync;
 
    end
    end
end
end
 
 
 
 
 
 
 
// Value for read back
 
assign ctrl_reg_o = {cpu_reset, stall_reg};
 
 
 
 
endmodule
endmodule
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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