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 100 and 101

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

Rev 100 Rev 101
Line 41... Line 41...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.1  2004/01/16 14:53:33  mohor
 
// *** empty log message ***
 
//
//
//
//
//
 
 
// synopsys translate_off
// synopsys translate_off
`include "timescale.v"
`include "timescale.v"
// 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_in,
                            data_i,
                            data_out,
                            data_o,
                            address,
                            addr_i,
                            rw,
                            we_i,
                            access,
                            en_i,
                            clk,
                            clk_i,
                            bp,
                            bp_i,
                            reset,
                            rst_i,
                            cpu_stall,
                            cpu_clk_i,
                            cpu_stall_all,
                            cpu_stall_o,
                            cpu_sel,
                            cpu_stall_all_o,
                            cpu_reset
                            cpu_sel_o,
 
                            cpu_rst_o
                          );
                          );
 
 
 
 
input            [7:0]  data_in;
input            [7:0]  data_i;
input            [1:0]  address;
input            [1:0]  addr_i;
 
 
input                   rw;
 
input                   access;
 
input                   clk;
 
input                   bp;
 
input                   reset;
 
 
 
output           [7:0]  data_out;
 
reg              [7:0]  data_out;
 
 
 
output                  cpu_stall;
 
output                  cpu_stall_all;
 
output [`CPU_NUM -1:0]  cpu_sel;
 
output                  cpu_reset;
 
 
 
 
input                   we_i;
 
input                   en_i;
 
input                   clk_i;
 
input                   bp_i;
 
input                   rst_i;
 
input                   cpu_clk_i;
 
 
 
output           [7:0]  data_o;
 
reg              [7:0]  data_o;
 
 
 
output                  cpu_stall_o;
 
output                  cpu_stall_all_o;
 
output [`CPU_NUM -1:0]  cpu_sel_o;
 
output                  cpu_rst_o;
 
 
 
wire                    cpu_stall;
 
wire                    cpu_stall_all;
 
wire                    cpu_reset;
wire             [2:1]  cpu_op_out;
wire             [2:1]  cpu_op_out;
wire   [`CPU_NUM -1:0]  cpu_sel_out;
wire   [`CPU_NUM -1:0]  cpu_sel_out;
 
 
wire                    cpuop_wr;
wire                    cpuop_wr;
wire                    cpusel_wr;
wire                    cpusel_wr;
 
 
 
reg                     cpusel_wr_sync;
 
reg                     cpusel_wr_cpu;
reg                     cpu_stall_bp;
reg                     cpu_stall_bp;
 
reg                     cpu_stall_sync;
 
reg                     cpu_stall_o;
 
reg                     cpu_stall_all_sync;
 
reg                     cpu_stall_all_o;
 
reg                     cpu_reset_sync;
 
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);
 
 
assign cpuop_wr      = access & rw & (address == `CPUOP_ADR);
 
assign cpusel_wr     = access & rw & (address == `CPUSEL_ADR);
 
 
 
 
// Synchronising we for cpu_sel register that works in cpu_clk clock domain
 
always @ (posedge cpu_clk_i)
 
begin
 
  cpusel_wr_sync <= #1 cpusel_wr;
 
  cpusel_wr_cpu  <= #1 cpusel_wr_sync;
 
end
 
 
 
 
always @(posedge clk or posedge reset)
 
 
always @(posedge clk_i or posedge rst_i)
begin
begin
  if(reset)
  if(rst_i)
    cpu_stall_bp <= 1'b0;
    cpu_stall_bp <= 1'b0;
  else if(bp)                     // Breakpoint sets bit
  else if(bp_i)                     // Breakpoint sets bit
    cpu_stall_bp <= 1'b1;
    cpu_stall_bp <= 1'b1;
  else if(cpuop_wr)               // Register access can set or clear bit
  else if(cpuop_wr)               // Register access can set or clear bit
    cpu_stall_bp <= data_in[0];
    cpu_stall_bp <= data_i[0];
end
end
 
 
 
 
dbg_register #(2, 0)          CPUOP  (.data_in(data_in[2:1]),           .data_out(cpu_op_out[2:1]), .write(cpuop_wr),   .clk(clk), .reset(reset));
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));
dbg_register #(`CPU_NUM, 0)   CPUSEL (.data_in(data_in[`CPU_NUM-1:0]),  .data_out(cpu_sel_out),     .write(cpusel_wr),  .clk(clk), .reset(reset));
dbg_register #(`CPU_NUM, 0)   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)
always @ (posedge clk_i)
begin
begin
  case (address)         // Synthesis parallel_case
  case (addr_i)         // Synthesis parallel_case
    `CPUOP_ADR  : data_out<= #1 {5'h0, cpu_op_out[2:1], cpu_stall};
    `CPU_OP_ADR  : data_o <= #1 {5'h0, cpu_op_out[2:1], cpu_stall};
    `CPUSEL_ADR : data_out<= #1 {{(8-`CPU_NUM){1'b0}}, cpu_sel_out};
    `CPU_SEL_ADR : data_o <= #1 {{(8-`CPU_NUM){1'b0}}, cpu_sel_out};
    default     : data_out<= #1 8'h0;
    default      : data_o <= #1 8'h0;
  endcase
  endcase
end
end
 
 
 
 
assign cpu_stall          = bp | cpu_stall_bp;   // bp asynchronously sets the cpu_stall, then cpu_stall_bp (from register) holds it active
assign cpu_stall          = bp_i | cpu_stall_bp;   // bp asynchronously sets the cpu_stall, then cpu_stall_bp (from register) holds it active
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
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
assign cpu_sel            = cpu_sel_out;
assign cpu_sel_o          = cpu_sel_out;
assign cpu_reset          = cpu_op_out[1];
assign cpu_reset          = cpu_op_out[1];
 
 
 
 
 
 
 
 
 
// Synchronizing signals from registers
 
always @ (posedge cpu_clk_i)
 
begin
 
  cpu_stall_sync      <= #1 cpu_stall;
 
  cpu_stall_o         <= #1 cpu_stall_sync;
 
  cpu_stall_all_sync  <= #1 cpu_stall_all;
 
  cpu_stall_all_o     <= #1 cpu_stall_all_sync;
 
  cpu_reset_sync      <= #1 cpu_reset;
 
  cpu_rst_o           <= #1 cpu_reset_sync;
 
end
 
 
 
 
 
 
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.