📄 debug.vhd
字号:
end if; end if; end if; end process Delay_slot_instruction; Delay_Slot_Instr <= delay_slot_instr_i; Status_Reg_Handle : process (TCLK) is variable stop_Instr_Fetch_1 : std_logic; variable pc_hit_1 : std_logic_vector(0 to 15); begin -- process Status_Reg_Handle if TCLK'event and TCLK = '1' then -- rising clock edge if (Capture = '1') then status_Reg(16) <= stop_Instr_Fetch_1; if (reset) then status_Reg(17) <= '1'; else status_Reg(17) <= '0'; end if; status_Reg(18) <= Full_32_bit; status_Reg(19) <= delay_slot_instr_i; status_Reg(20) <= Full_32_bit_1; status_Reg(21) <= fsl_stalled_1; status_Reg(22) <= memory_stalled_1; status_Reg(0 to 15) <= pc_hit_1; end if; fsl_stalled_1 <= FSL_Stalled; memory_stalled_1 <= Memory_Stalled; stop_Instr_Fetch_1 := Stop_Instr_Fetch_i; pc_hit_1 := pc_hit; end if; end process Status_Reg_Handle; -- TDO_Status_Reg_for_simulation -- pragma translate_off TDO_Status_Reg_for_simulation: process (shift_Count) is begin -- process Process_Only_For_Simulation if (unsigned(shift_Count) < status_Reg'length) then -- pragma translate_on TDO_Status_Reg <= status_Reg(to_integer(unsigned(shift_Count))); -- pragma translate_off else TDO_Status_Reg <= '0'; end if; end process TDO_Status_Reg_for_simulation; -- pragma translate_on ----------------------------------------------------------------------------- -- Shifting in data into a 32-bit shift register ----------------------------------------------------------------------------- Shift_DataIn_Handle : process (TClk) is begin -- process Shift_DataIn_Handle if TClk'event and TClk = '1' then -- rising clock edge shift_datain(0 to shift_datain'right-1) <= shift_datain(1 to shift_datain'right); shift_datain(shift_datain'right) <= TDI; end if; end process Shift_DataIn_Handle; ----------------------------------------------------------------------------- -- Handling the Control Register ----------------------------------------------------------------------------- Control_Reg_Handle : process (Update) is begin -- process Control_Reg_Handle if Update'event and Update = '1' then -- rising clock edge if Control_Reg_En = '1' then-- control_Reg <= shift_datain(shift_datain'right-control_Reg'length to shift_datain'right-1); control_Reg <= shift_datain(shift_datain'right-control_Reg'length+1 to shift_datain'right); end if; end if; end process Control_Reg_Handle; Single_Step_Control_Reg_Handle : process (Update,start_single_step) is begin -- process Single_Step_Control_Reg_Handle if (start_single_step = '1') then single_Step_TClk <= '0'; elsif Update'event and Update = '1' then -- rising clock edge if Control_Reg_En = '1' then single_Step_TClk <= shift_datain(shift_datain'right - control_Reg'length + 1 + single_step_pos_C); end if; end if; end process Single_Step_Control_Reg_Handle; Continue_from_brk_Control_Reg_Handle : process (Update,continue_from_brk) is begin -- process Continue_from_brk_Control_Reg_Handle if (continue_from_brk = '1') then continue_from_brk_TClk <= '0'; elsif Update'event and Update = '1' then -- rising clock edge if Control_Reg_En = '1' then continue_from_brk_TClk <= shift_datain(shift_datain'right - control_Reg'length + 1 + continue_pos_C); end if; end if; end process Continue_from_brk_Control_Reg_Handle; Control_Reg_D <= Control_Reg(0 to 3); Command_Reg_D(0 to 6) <= command_reg(0 to 1) & "00000"; Command_Reg_D(7) <= read_pc; armed <= control_Reg(0); Dbg_Disable_Interrupt <= (control_reg(dis_intr_pos_C) = '1'); free_running <= not armed; Detect_single_step_cmd : process (Clk) is variable prev : std_logic; variable prev_1 : std_logic; begin -- process Detect_single_step_cmd if Clk'event and Clk = '1' then -- rising clock edge if Reset then -- synchronous reset (active high) prev := '0'; prev_1 := '0'; start_single_cmd <= '0'; else start_single_cmd <= prev and not prev_1; prev_1 := prev; prev := single_Step_TClk; end if; end if; end process Detect_single_step_cmd; single_step_DFF : process (Clk) is begin -- process single_step_DFF if Clk'event and Clk = '1' then -- rising clock edge if Reset then -- synchronous reset (active high) single_Step_N <= '1'; start_single_step <= '0'; single_step_count <= "00"; else if (start_single_cmd) = '1' then start_single_step <= '1'; single_step_count <= control_reg(single_value_pos_C to single_value_pos_C+1); end if; if( Ok_To_Stop = '1' ) then single_step_count <= std_logic_vector(unsigned(single_step_count) - 1); if (start_single_step = '1') and (single_step_count = "00") then start_single_step <= '0'; single_Step_N <= '0'; else single_Step_N <= '1'; end if; end if; end if; end if; end process single_step_DFF; Continue_from_Brk_DFF : process (Clk) is variable prev : std_logic; variable prev_1 : std_logic; begin -- process Continue_from_Brk_DFF if Clk'event and Clk = '1' then -- rising clock edge if Reset then prev := '0'; prev_1 := '0'; continue_from_brk <= '0'; else continue_from_brk <= prev and not prev_1; prev_1 := prev; prev := continue_from_brk_TClk; end if; end if; end process Continue_from_Brk_DFF; ----------------------------------------------------------------------------- -- Handling the Instr_Insert_Reg -- Can't assume that TCK is slower than CLK ----------------------------------------------------------------------------- Instr_Insert_Reg_Handle : process (TClk) is variable tmp : std_logic := '0'; begin -- process Instr_Insert_Reg_Handle if TClk'event and TClk = '1' then -- rising clock edge Instr_Insert_Reg_En_1 <= Instr_Insert_Reg_En; if Instr_Insert_Reg_En = '1' then if (shift_Count(4 downto 0) = "11110") then New_Dbg_Instr_TCK <= '1'; else New_Dbg_Instr_TCK <= '0'; end if; else New_Dbg_Instr_TCK <= '0'; end if; end if; end process Instr_Insert_Reg_Handle; New_Instr_Reg_TCK_Handle : process (TClk) is begin -- process New_Instr_Reg_TCK_Handle if TClk'event and TClk = '1' then -- rising clock edge New_Dbg_Instr2_TCK <= '0'; if New_Dbg_Instr_TCK = '1' then New_Instr_Reg_TCK <= shift_datain(1 to 31) & TDI; New_Dbg_Instr2_TCK <= '1'; end if; end if; end process New_Instr_Reg_TCK_Handle; Instr_Debug <= New_Instr_Reg_TCK; Debug_Ready_Handle : process (Clk) is begin -- process Debug_Ready_Handle if Clk'event and Clk = '1' then -- rising clock edge if Reset then -- synchronous reset (active true) New_Dbg_Instr_CLK <= '0'; New_Dbg_Instr2_CLK <= '0'; Debug_Ready_i <= '0'; else New_Dbg_Instr_CLK <= New_Dbg_Instr2_TCK; New_Dbg_Instr2_CLK <= New_Dbg_Instr_CLK; Debug_Ready_i <= not New_Dbg_Instr2_CLK and New_Dbg_Instr_CLK; end if; end if; end process Debug_Ready_Handle; Debug_Ready <= Debug_Ready_i; First_Instruction_to_execute_Handle : process (Clk) is begin -- process First_Instruction_to_execute_Handle if Clk'event and Clk = '1' then -- rising clock edge if Reset then -- synchronous reset (active true) Start_Dbg_Exec <= '0'; else Start_Dbg_Exec <= Debug_Ready_i; end if; end if; end process First_Instruction_to_execute_Handle; Data_read_reg_Handle : process (TClk) is begin -- process Data_read_reg_Handle if TClk'event and TClk = '1' then -- rising clock edge if (Capture = '1') then data_read_reg <= data_rd_reg; end if; end if; end process Data_read_reg_Handle; -- pragma translate_off TDO_Data_Reg_for_simulation: process (shift_Count) is begin -- process Process_Only_For_Simulation if (unsigned(shift_Count) < data_read_reg'length) then -- pragma translate_on TDO_Data_Reg <= data_read_reg(to_integer(unsigned(shift_Count))); -- pragma translate_off else TDO_Data_Reg <= '0'; end if; end process TDO_Data_Reg_for_simulation; -- pragma translate_on data_rd_reg_handle : process (Clk) is begin -- process data_rd_reg_handle if Clk'event and Clk = '1' then -- rising clock edge if Reset then data_rd_reg <= (others => '0'); read_pc <= '0'; Instr_Insert_Reg_En_Clk <= '0'; Command_Reg_Rst <= '0'; else Command_Reg_Rst <= '0'; Instr_Insert_Reg_En_Clk <= Instr_Insert_Reg_En; if (read_register_PC_1 = '1') then data_rd_reg(0 to C_DATA_SIZE-1) <= pc_ex; data_rd_reg(C_DATA_SIZE) <= Valid_Instr or Dbg_Inhibit_EX_i; read_pc <= '1'; Command_Reg_Rst <= '1'; end if; if (read_register_MSR_1 = '1') then data_rd_reg <= (others => '0'); read_pc <= '0'; data_rd_reg(C_DATA_SIZE-MSR_REG_TYPE'length to C_DATA_SIZE-1) <= MSR; Command_Reg_Rst <= '1'; end if; if (Stop_Instr_Fetch_i = '1') then read_pc <= '0'; if (Reg_Write = '1') then data_rd_reg(0 to C_DATA_SIZE-1) <= New_Reg_Value; data_rd_reg(C_DATA_SIZE) <= '1'; end if; end if; end if; end if; end process data_rd_reg_handle; ----------------------------------------------------------------------------- -- Handling the Command Register ----------------------------------------------------------------------------- Command_Reg_Handle : process (Update, Command_Reg_Rst) is begin -- process Command_Reg_Handle if (Command_Reg_Rst = '1') then Command_Reg <= (others => '0'); elsif Update'event and Update = '1' then -- rising clock edge if Command_Reg_En = '1' then command_Reg <= shift_datain(shift_datain'right-command_Reg'length+1 to shift_datain'right); end if; end if; end process Command_Reg_Handle; Command_Reg_DFF : process (Clk) is variable prev : std_logic_vector(command_reg'range); variable prev_1 : std_logic_vector(command_reg'range); begin -- process Command_Reg_DFF if Clk'event and Clk = '1' then -- rising clock edge if Reset then read_register_MSR <= '0'; read_register_PC <= '0'; prev_1 := (others => '0'); prev := (others => '0'); else read_register_MSR <= '0'; read_register_PC <= '0'; if (prev_1(0) = '0' and prev(0) = '1') then read_register_MSR <= '1'; end if; if (prev_1(1) = '0' and prev(1) = '1') then read_register_PC <= '1'; end if; prev_1 := prev; prev := command_reg; end if; end if;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -