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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [highland_ver1/] [rtl/] [verilog/] [dbg_cpu.v] - Diff between revs 121 and 123

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

Rev 121 Rev 123
Line 41... Line 41...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.6  2004/01/22 13:58:53  mohor
 
// Port signals are all set to zero after reset.
 
//
// Revision 1.5  2004/01/19 07:32:41  simons
// Revision 1.5  2004/01/19 07:32:41  simons
// Reset values width added because of FV, a good sentence changed because some tools can not handle it.
// Reset values width added because of FV, a good sentence changed because some tools can not handle it.
//
//
// Revision 1.4  2004/01/17 18:38:11  mohor
// Revision 1.4  2004/01/17 18:38:11  mohor
// cpu_tall_o is set with cpu_stb_o or register.
// cpu_tall_o is set with cpu_stb_o or register.
Line 273... Line 276...
    crc_cnt <= #1 6'h0;
    crc_cnt <= #1 6'h0;
end
end
 
 
 
 
// Upper limit. Address/length counter counts until this value is reached
// Upper limit. Address/length counter counts until this value is reached
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (cmd_cnt == 2'h2)
  if (rst_i)
 
    addr_cnt_limit = 6'd0;
 
  else if (cmd_cnt == 2'h2)
    begin
    begin
      if ((~dr[0])  & (~tdi_i))                                   // (current command is WB_STATUS or WB_GO)
      if ((~dr[0])  & (~tdi_i))                                   // (current command is WB_STATUS or WB_GO)
        addr_cnt_limit = 6'd0;
        addr_cnt_limit = 6'd0;
      else                                                        // (current command is WB_WRITEx or WB_READx)
      else                                                        // (current command is WB_WRITEx or WB_READx)
        addr_cnt_limit = 6'd32;
        addr_cnt_limit = 6'd32;
Line 291... Line 296...
assign addr_cnt_end = addr_cnt == addr_cnt_limit;
assign addr_cnt_end = addr_cnt == addr_cnt_limit;
assign crc_cnt_end  = crc_cnt  == 6'd32;
assign crc_cnt_end  = crc_cnt  == 6'd32;
assign crc_cnt_31 = crc_cnt  == 6'd31;
assign crc_cnt_31 = crc_cnt  == 6'd31;
assign data_cnt_end = (data_cnt == data_cnt_limit);
assign data_cnt_end = (data_cnt == data_cnt_limit);
 
 
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
 
begin
 
  if (rst_i)
 
    begin
 
      crc_cnt_end_q  <= #1 1'b0;
 
      cmd_cnt_end_q  <= #1 1'b0;
 
      data_cnt_end_q <= #1 1'b0;
 
    end
 
  else
begin
begin
  crc_cnt_end_q  <= #1 crc_cnt_end;
  crc_cnt_end_q  <= #1 crc_cnt_end;
  cmd_cnt_end_q  <= #1 cmd_cnt_end;
  cmd_cnt_end_q  <= #1 cmd_cnt_end;
  data_cnt_end_q <= #1 data_cnt_end;
  data_cnt_end_q <= #1 data_cnt_end;
end
end
 
end
 
 
 
 
// Status counter is made of 4 serialy connected registers
// Status counter is made of 4 serialy connected registers
always @ (posedge tck_i or posedge rst_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
Line 385... Line 399...
assign dr_write_cpu32 = dr[2:0] == `CPU_WRITE32;
assign dr_write_cpu32 = dr[2:0] == `CPU_WRITE32;
assign dr_go          = dr[2:0] == `CPU_GO;
assign dr_go          = dr[2:0] == `CPU_GO;
 
 
 
 
// Latching instruction
// Latching instruction
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (update_dr_i)
  if (rst_i)
 
    begin
 
      dr_read_reg_latched  <= #1 1'b0;
 
      dr_read_cpu8_latched  <= #1 1'b0;
 
      dr_read_cpu32_latched  <= #1 1'b0;
 
      dr_write_reg_latched  <= #1 1'b0;
 
      dr_write_cpu8_latched  <= #1 1'b0;
 
      dr_write_cpu32_latched  <= #1 1'b0;
 
      dr_go_latched  <= #1 1'b0;
 
    end
 
  else if (update_dr_i)
    begin
    begin
      dr_read_reg_latched  <= #1 1'b0;
      dr_read_reg_latched  <= #1 1'b0;
      dr_read_cpu8_latched  <= #1 1'b0;
      dr_read_cpu8_latched  <= #1 1'b0;
      dr_read_cpu32_latched  <= #1 1'b0;
      dr_read_cpu32_latched  <= #1 1'b0;
      dr_write_reg_latched  <= #1 1'b0;
      dr_write_reg_latched  <= #1 1'b0;
Line 449... Line 473...
 
 
 
 
assign go_prelim = (cmd_cnt == 2'h2) & dr[1] & (~dr[0]) & (~tdi_i);
assign go_prelim = (cmd_cnt == 2'h2) & dr[1] & (~dr[0]) & (~tdi_i);
 
 
 
 
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (update_dr_i)
  if (rst_i)
 
    read_cycle_reg <= #1 1'b0;
 
  else if (update_dr_i)
    read_cycle_reg <= #1 1'b0;
    read_cycle_reg <= #1 1'b0;
  else if (cmd_read_reg & go_prelim)
  else if (cmd_read_reg & go_prelim)
    read_cycle_reg <= #1 1'b1;
    read_cycle_reg <= #1 1'b1;
end
end
 
 
 
 
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (update_dr_i)
  if (rst_i)
 
    read_cycle_cpu <= #1 1'b0;
 
  else if (update_dr_i)
    read_cycle_cpu <= #1 1'b0;
    read_cycle_cpu <= #1 1'b0;
  else if (cmd_read_cpu & go_prelim)
  else if (cmd_read_cpu & go_prelim)
    read_cycle_cpu <= #1 1'b1;
    read_cycle_cpu <= #1 1'b1;
end
end
 
 
 
 
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
 
begin
 
  if (rst_i)
 
    begin
 
      read_cycle_reg_q <= #1 1'b0;
 
      read_cycle_cpu_q <= #1 1'b0;
 
    end
 
  else
begin
begin
  read_cycle_reg_q <= #1 read_cycle_reg;
  read_cycle_reg_q <= #1 read_cycle_reg;
  read_cycle_cpu_q <= #1 read_cycle_cpu;
  read_cycle_cpu_q <= #1 read_cycle_cpu;
end
end
 
end
 
 
 
 
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if (update_dr_i)
  if (rst_i)
 
    write_cycle_reg <= #1 1'b0;
 
  else if (update_dr_i)
    write_cycle_reg <= #1 1'b0;
    write_cycle_reg <= #1 1'b0;
  else if (cmd_write_reg & go_prelim)
  else if (cmd_write_reg & go_prelim)
    write_cycle_reg <= #1 1'b1;
    write_cycle_reg <= #1 1'b1;
end
end
 
 
Line 500... Line 538...
assign write_cycle = write_cycle_reg | write_cycle_cpu;
assign write_cycle = write_cycle_reg | write_cycle_cpu;
 
 
 
 
 
 
// Start register access cycle
// Start register access cycle
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
 
  if (write_cycle_reg & data_cnt_end & (~data_cnt_end_q) | read_cycle_reg & (~read_cycle_reg_q))
 
    begin
    begin
 
  if (rst_i)
 
    reg_access <= #1 1'b0;
 
  else if (write_cycle_reg & data_cnt_end & (~data_cnt_end_q) | read_cycle_reg & (~read_cycle_reg_q))
      reg_access <= #1 1'b1;
      reg_access <= #1 1'b1;
    end
 
  else
  else
    reg_access <= #1 1'b0;
    reg_access <= #1 1'b0;
end
end
 
 
 
 
Line 539... Line 577...
assign cpu_stall_o = cpu_stb_o | cpu_stall_tmp;
assign cpu_stall_o = cpu_stb_o | cpu_stall_tmp;
 
 
 
 
 
 
// Synchronizing ack signal from cpu
// Synchronizing ack signal from cpu
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
 
begin
 
  if (rst_i)
 
    begin
 
      cpu_ack_sync      <= #1 1'b0;
 
      cpu_ack_tck       <= #1 1'b0;
 
      cpu_ack_tck_q     <= #1 1'b0;
 
    end
 
  else
begin
begin
  cpu_ack_sync      <= #1 cpu_ack_i;
  cpu_ack_sync      <= #1 cpu_ack_i;
  cpu_ack_tck       <= #1 cpu_ack_sync;
  cpu_ack_tck       <= #1 cpu_ack_sync;
  cpu_ack_tck_q     <= #1 cpu_ack_tck;
  cpu_ack_tck_q     <= #1 cpu_ack_tck;
end
end
 
end
 
 
 
 
 
 
// Start cpu access cycle
// Start cpu access cycle
always @ (posedge tck_i or posedge rst_i)
always @ (posedge tck_i or posedge rst_i)
Line 562... Line 609...
end
end
 
 
 
 
 
 
// Synchronizing cpu_stb to cpu_clk_i clock
// Synchronizing cpu_stb to cpu_clk_i clock
always @ (posedge cpu_clk_i)
always @ (posedge cpu_clk_i or posedge rst_i)
 
begin
 
  if (rst_i)
 
    begin
 
      cpu_stb_sync  <= #1 1'b0;
 
      cpu_stb_o     <= #1 1'b0;
 
    end
 
  else
begin
begin
  cpu_stb_sync  <= #1 cpu_stb;
  cpu_stb_sync  <= #1 cpu_stb;
  cpu_stb_o     <= #1 cpu_stb_sync;
  cpu_stb_o     <= #1 cpu_stb_sync;
end
end
 
end
 
 
 
 
// Latching crc
// Latching crc
always @ (posedge tck_i)
always @ (posedge tck_i or posedge rst_i)
begin
begin
  if(crc_cnt_end & (~crc_cnt_end_q))
  if (rst_i)
 
    crc_match_reg <= #1 1'b0;
 
  else if(crc_cnt_end & (~crc_cnt_end_q))
    crc_match_reg <= #1 crc_match_i;
    crc_match_reg <= #1 crc_match_i;
end
end
 
 
 
 
 
 
// 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
 
    status <= #1 4'h0;
    status <= #1 4'h0;
    end
 
  else if(crc_cnt_end & (~crc_cnt_end_q) & (~read_cycle))
  else if(crc_cnt_end & (~crc_cnt_end_q) & (~read_cycle))
    begin
 
    status <= #1 {crc_match_i, 1'b0, 1'b1, 1'b0};
    status <= #1 {crc_match_i, 1'b0, 1'b1, 1'b0};
    end
 
  else if (data_cnt_end & (~data_cnt_end_q) & read_cycle)
  else if (data_cnt_end & (~data_cnt_end_q) & read_cycle)
    begin
 
    status <= #1 {crc_match_reg, 1'b0, 1'b1, 1'b0};
    status <= #1 {crc_match_reg, 1'b0, 1'b1, 1'b0};
    end
 
  else if (shift_dr_i & (~status_cnt_end))
  else if (shift_dr_i & (~status_cnt_end))
    begin
 
    status <= #1 {status[0], status[3:1]};
    status <= #1 {status[0], status[3:1]};
    end
    end
end
 
// Following status is shifted out:
// Following status is shifted out:
// 1. bit:          1 if crc is OK, else 0
// 1. bit:          1 if crc is OK, else 0
// 2. bit:          1'b0
// 2. bit:          1'b0
// 3. bit:          1'b1
// 3. bit:          1'b1
// 4. bit:          1'b0
// 4. bit:          1'b0

powered by: WebSVN 2.1.0

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