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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [asyst_3/] [rtl/] [verilog/] [dbg_cpu.v] - Diff between revs 141 and 143

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

Rev 141 Rev 143
Line 41... Line 41...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.9  2004/03/31 14:34:09  igorm
 
// data_cnt_lim length changed to reduce number of warnings.
 
//
// Revision 1.8  2004/03/28 20:27:01  igorm
// Revision 1.8  2004/03/28 20:27:01  igorm
// New release of the debug interface (3rd. release).
// New release of the debug interface (3rd. release).
//
//
// Revision 1.7  2004/01/25 14:04:18  mohor
// Revision 1.7  2004/01/25 14:04:18  mohor
// All flipflops are reset.
// All flipflops are reset.
Line 235... Line 238...
assign acc_type_read    = (acc_type == `DBG_CPU_READ);
assign acc_type_read    = (acc_type == `DBG_CPU_READ);
assign acc_type_write   = (acc_type == `DBG_CPU_WRITE);
assign acc_type_write   = (acc_type == `DBG_CPU_WRITE);
 
 
 
 
 
 
reg [799:0] dr_text;
 
// Shift register for shifting in and out the data
// Shift register for shifting in and out the data
always @ (posedge tck_i or posedge rst_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (rst_i)
  if (rst_i)
    begin
    begin
      latch_data <= #1 1'b0;
      latch_data <= #1 1'b0;
      dr <= #1 {`DBG_CPU_DR_LEN{1'b0}};
      dr <= #1 {`DBG_CPU_DR_LEN{1'b0}};
      dr_text = "reset";
 
    end
    end
  else if (curr_cmd_rd_comm && crc_cnt_31)  // Latching data (from internal regs)
  else if (curr_cmd_rd_comm && crc_cnt_31)  // Latching data (from internal regs)
    begin
    begin
      dr[`DBG_CPU_ACC_TYPE_LEN + `DBG_CPU_ADR_LEN + `DBG_CPU_LEN_LEN -1:0] <= #1 {acc_type, adr, len};
      dr[`DBG_CPU_ACC_TYPE_LEN + `DBG_CPU_ADR_LEN + `DBG_CPU_LEN_LEN -1:0] <= #1 {acc_type, adr, len};
      dr_text = "latch reg data";
 
    end
    end
  else if (curr_cmd_rd_ctrl && crc_cnt_31)  // Latching data (from control regs)
  else if (curr_cmd_rd_ctrl && crc_cnt_31)  // Latching data (from control regs)
    begin
    begin
      dr[`DBG_CPU_DR_LEN -1:`DBG_CPU_DR_LEN -`DBG_CPU_CTRL_LEN] <= #1 ctrl_reg;
      dr[`DBG_CPU_DR_LEN -1:`DBG_CPU_DR_LEN -`DBG_CPU_CTRL_LEN] <= #1 ctrl_reg;
      dr_text = "latch ctrl reg data";
 
    end
    end
  else if (acc_type_read && curr_cmd_go && crc_cnt_31)  // Latchind first data (from WB)
  else if (acc_type_read && curr_cmd_go && crc_cnt_31)  // Latchind first data (from WB)
    begin
    begin
      dr[31:0] <= #1 input_data[31:0];
      dr[31:0] <= #1 input_data[31:0];
      latch_data <= #1 1'b1;
      latch_data <= #1 1'b1;
      dr_text = "latch first data";
 
    end
    end
  else if (acc_type_read && curr_cmd_go && crc_cnt_end) // Latching data (from WB)
  else if (acc_type_read && curr_cmd_go && crc_cnt_end) // Latching data (from WB)
    begin
    begin
      case (acc_type)  // synthesis parallel_case full_case
      case (acc_type)  // synthesis parallel_case full_case
        `DBG_CPU_READ: begin
        `DBG_CPU_READ: begin
                      if(long & (~long_q))
                      if(long & (~long_q))
                        begin
                        begin
                          dr[31:0] <= #1 input_data[31:0];
                          dr[31:0] <= #1 input_data[31:0];
                          latch_data <= #1 1'b1;
                          latch_data <= #1 1'b1;
                          dr_text = "latch_data word";
 
                        end
                        end
                      else
                      else
                        begin
                        begin
                          dr[31:0] <= #1 {dr[30:0], 1'b0};
                          dr[31:0] <= #1 {dr[30:0], 1'b0};
                          latch_data <= #1 1'b0;
                          latch_data <= #1 1'b0;
                          dr_text = "shift word";
 
                        end
                        end
                    end
                    end
      endcase
      endcase
    end
    end
  else if (enable && (!addr_len_cnt_end))
  else if (enable && (!addr_len_cnt_end))
    begin
    begin
      dr <= #1 {dr[`DBG_CPU_DR_LEN -2:0], tdi_i};
      dr <= #1 {dr[`DBG_CPU_DR_LEN -2:0], tdi_i};
      dr_text = "shift dr";
 
    end
    end
end
end
 
 
 
 
 
 
Line 862... Line 857...
  else if (!(cpu_end_tck && (!cpu_end_tck_q)) && latch_data && (fifo_full))  // decrementing
  else if (!(cpu_end_tck && (!cpu_end_tck_q)) && latch_data && (fifo_full))  // decrementing
    fifo_full <= #1 1'h0;
    fifo_full <= #1 1'h0;
end
end
 
 
 
 
reg [799:0] tdo_text;
 
 
 
// TDO multiplexer
// TDO multiplexer
always @ (pause_dr_i or busy_tck or crc_cnt_end or crc_cnt_end_q or curr_cmd_wr_comm or curr_cmd_wr_ctrl or curr_cmd_go or acc_type_write or acc_type_read or crc_match_i or data_cnt_end or dr or data_cnt_end_q or crc_match_reg or status_cnt_en or status or addr_len_cnt_end or addr_len_cnt_end_q or curr_cmd_rd_comm or curr_cmd_rd_ctrl)
always @ (pause_dr_i or busy_tck or crc_cnt_end or crc_cnt_end_q or curr_cmd_wr_comm or curr_cmd_wr_ctrl or curr_cmd_go or acc_type_write or acc_type_read or crc_match_i or data_cnt_end or dr or data_cnt_end_q or crc_match_reg or status_cnt_en or status or addr_len_cnt_end or addr_len_cnt_end_q or curr_cmd_rd_comm or curr_cmd_rd_ctrl)
begin
begin
  if (pause_dr_i)
  if (pause_dr_i)
    begin
    begin
    tdo_o = busy_tck;
    tdo_o = busy_tck;
    tdo_text = "busy_tck";
 
    end
    end
  else if (crc_cnt_end && (!crc_cnt_end_q) && (curr_cmd_wr_comm || curr_cmd_wr_ctrl || curr_cmd_go && acc_type_write ))
  else if (crc_cnt_end && (!crc_cnt_end_q) && (curr_cmd_wr_comm || curr_cmd_wr_ctrl || curr_cmd_go && acc_type_write ))
    begin
    begin
      tdo_o = ~crc_match_i;
      tdo_o = ~crc_match_i;
      tdo_text = "crc_match_i";
 
    end
    end
  else if (curr_cmd_go && acc_type_read && crc_cnt_end && (!data_cnt_end))
  else if (curr_cmd_go && acc_type_read && crc_cnt_end && (!data_cnt_end))
    begin
    begin
      tdo_o = dr[31];
      tdo_o = dr[31];
      tdo_text = "dr[31]";
 
    end
    end
  else if (curr_cmd_go && acc_type_read && data_cnt_end && (!data_cnt_end_q))
  else if (curr_cmd_go && acc_type_read && data_cnt_end && (!data_cnt_end_q))
    begin
    begin
      tdo_o = ~crc_match_reg;
      tdo_o = ~crc_match_reg;
      tdo_text = "crc_match_reg";
 
    end
    end
  else if ((curr_cmd_rd_comm || curr_cmd_rd_ctrl) && addr_len_cnt_end && (!addr_len_cnt_end_q))
  else if ((curr_cmd_rd_comm || curr_cmd_rd_ctrl) && addr_len_cnt_end && (!addr_len_cnt_end_q))
    begin
    begin
      tdo_o = ~crc_match_reg;
      tdo_o = ~crc_match_reg;
      tdo_text = "crc_match_reg_rd_comm";
 
    end
    end
  else if ((curr_cmd_rd_comm || curr_cmd_rd_ctrl) && crc_cnt_end && (!addr_len_cnt_end))
  else if ((curr_cmd_rd_comm || curr_cmd_rd_ctrl) && crc_cnt_end && (!addr_len_cnt_end))
    begin
    begin
      tdo_o = dr[`DBG_CPU_ACC_TYPE_LEN + `DBG_CPU_ADR_LEN + `DBG_CPU_LEN_LEN -1];
      tdo_o = dr[`DBG_CPU_ACC_TYPE_LEN + `DBG_CPU_ADR_LEN + `DBG_CPU_LEN_LEN -1];
      tdo_text = "rd_comm | rd_ctrl data";
 
    end
    end
  else if (status_cnt_en)
  else if (status_cnt_en)
    begin
    begin
      tdo_o = status[3];
      tdo_o = status[3];
      tdo_text = "status";
 
    end
    end
  else
  else
    begin
    begin
      tdo_o = 1'b0;
      tdo_o = 1'b0;
      tdo_text = "zero";
 
    end
    end
end
end
 
 
reg [799:0] status_text;
 
// Status register
// Status register
always @ (posedge tck_i or posedge rst_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (rst_i)
  if (rst_i)
    begin
    begin
    status <= #1 {`DBG_CPU_STATUS_LEN{1'b0}};
    status <= #1 {`DBG_CPU_STATUS_LEN{1'b0}};
    status_text = "reset";
 
    end
    end
  else if(crc_cnt_end && (!crc_cnt_end_q) && (!(curr_cmd_go && acc_type_read)))
  else if(crc_cnt_end && (!crc_cnt_end_q) && (!(curr_cmd_go && acc_type_read)))
    begin
    begin
    status <= #1 {1'b0, 1'b0, cpu_overrun_tck, crc_match_i};
    status <= #1 {1'b0, 1'b0, cpu_overrun_tck, crc_match_i};
    status_text = "latch ni read";
 
    end
    end
  else if (data_cnt_end && (!data_cnt_end_q) && curr_cmd_go && acc_type_read)
  else if (data_cnt_end && (!data_cnt_end_q) && curr_cmd_go && acc_type_read)
    begin
    begin
    status <= #1 {1'b0, 1'b0, underrun_tck, crc_match_reg};
    status <= #1 {1'b0, 1'b0, underrun_tck, crc_match_reg};
    status_text = "latch read";
 
    end
    end
  else if (addr_len_cnt_end && (!addr_len_cnt_end) && (curr_cmd_rd_comm || curr_cmd_rd_ctrl))
  else if (addr_len_cnt_end && (!addr_len_cnt_end) && (curr_cmd_rd_comm || curr_cmd_rd_ctrl))
    begin
    begin
    status <= #1 {1'b0, 1'b0, 1'b0, crc_match_reg};
    status <= #1 {1'b0, 1'b0, 1'b0, crc_match_reg};
    status_text = "rd_comm | rd_ctrl";
 
    end
    end
  else if (shift_dr_i && (!status_cnt_end))
  else if (shift_dr_i && (!status_cnt_end))
    begin
    begin
    status <= #1 {status[`DBG_CPU_STATUS_LEN -2:0], status[`DBG_CPU_STATUS_LEN -1]};
    status <= #1 {status[`DBG_CPU_STATUS_LEN -2:0], status[`DBG_CPU_STATUS_LEN -1]};
    status_text = "shifting";
 
    end
    end
end
end
// Following status is shifted out (MSB first):
// Following status is shifted out (MSB first):
// 3. bit:          1 if crc is OK, else 0
// 3. bit:          1 if crc is OK, else 0
// 2. bit:          1'b0
// 2. bit:          1'b0

powered by: WebSVN 2.1.0

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