Support for showing both access address on read/write breakpoints

Change-Id: Ieae38f00dcbb2fa7bc8908e27098550c03e18055
This commit is contained in:
David Banks 2015-06-10 16:35:38 +01:00
parent d5854047d1
commit 16a4769b47
2 changed files with 58 additions and 36 deletions

View File

@ -23,8 +23,8 @@
#define OFFSET_BAH 3
#define OFFSET_WAL 4
#define OFFSET_WAH 5
#define OFFSET_BAM 7
#define OFFSET_WAM 8
#define OFFSET_BM 6
#define OFFSET_WM 7
// Commands
// 000x Enable/Disable single strpping
@ -203,6 +203,22 @@ void version() {
}
void lcdAddr(unsigned int addr) {
int i;
int nibble;
lcd_goto(6);
// Avoid using sprintf, as it adds quite a lot of code
for (i = 3; i >= 0; i--) {
nibble = addr >> (i * 4);
nibble &= 0x0F;
nibble += '0';
if (nibble > '9') {
nibble += 'A' - '9' - 1;
}
lcd_putc(nibble);
}
}
/*******************************************
* Commands
@ -217,25 +233,27 @@ void doCmdHelp(char *params) {
}
}
void doCmdAddr() {
int i, nibble;
unsigned int addr = hwRead16(OFFSET_IAL);
// Update the serial port
log0("%04X\n", addr);
unsigned int i_addr = hwRead16(OFFSET_IAL);
// Update the LCD display
lcd_goto(6);
// Avoid using sprintf, as it adds quite a lot of code
for (i = 3; i >= 0; i--) {
nibble = addr >> (i * 4);
nibble &= 0x0F;
nibble += '0';
if (nibble > '9') {
nibble += 'A' - '9' - 1;
}
lcd_putc(nibble);
lcdAddr(i_addr);
// Update the serial console
log0("%04X %04X %02X\n", i_addr);
}
void doCmdAddrDetail() {
unsigned int i_addr = hwRead16(OFFSET_IAL);
unsigned int b_addr = hwRead16(OFFSET_BAL);
unsigned int b_mode = hwRead8(OFFSET_BM);
// Update the LCD display
lcdAddr(i_addr);
// Update the serial console
log0("%s hit at %04X", brkptStrings[b_mode], i_addr);
if (b_mode != BRKPT_INSTR) {
log0(" accessing %04X", b_addr);
}
log0("\n");
}
void doCmdStep(char *params) {
@ -431,12 +449,7 @@ void doCmdContinue(char *params) {
} while (!(status & BRKPT_ACTIVE_MASK) && !(status && BRKPT_INTERRUPTED_MASK));
// Output cause
if (status & BRKPT_ACTIVE_MASK) {
log0("Breakpoint hit at ");
} else {
log0("Interrupted at ");
}
doCmdAddr();
doCmdAddrDetail();
// Enable single stepping
setSingle(1);

View File

@ -79,8 +79,6 @@ architecture behavioral of AtomBusMon is
signal addr_sync : std_logic_vector(15 downto 0);
signal addr_inst : std_logic_vector(15 downto 0);
signal addr_break : std_logic_vector(15 downto 0);
signal mode_break : std_logic_vector(7 downto 0);
signal addr_watch : std_logic_vector(15 downto 0);
signal mode_watch : std_logic_vector(7 downto 0);
@ -91,8 +89,10 @@ architecture behavioral of AtomBusMon is
signal brkpt_enable : std_logic;
signal brkpt_active : std_logic;
signal brkpt_active1 : std_logic;
signal brkpt_reg : std_logic_vector(79 downto 0);
signal brkpt_status : std_logic_vector(19 downto 0);
signal brkpt_status_latched : std_logic_vector(19 downto 0);
begin
@ -199,23 +199,25 @@ begin
mux <= addr_inst(7 downto 0) when muxsel = 0 else
addr_inst(15 downto 8) when muxsel = 1 else
addr_break(7 downto 0) when muxsel = 2 else
addr_break(15 downto 8) when muxsel = 3 else
brkpt_status_latched(7 downto 0) when muxsel = 2 else
brkpt_status_latched(15 downto 8) when muxsel = 3 else
addr_watch(7 downto 0) when muxsel = 4 else
addr_watch(15 downto 8) when muxsel = 5 else
mode_break when muxsel = 6 else
"0000" & brkpt_status_latched(19 downto 16) when muxsel = 6 else
mode_watch when muxsel = 7 else
"10101010";
brkpt_active_process: process (brkpt_reg, brkpt_enable, Addr, Sync)
variable tmp : std_logic;
variable active : std_logic;
variable status : std_logic_vector(19 downto 0);
variable i : integer;
variable brkpt_addr : std_logic_vector(15 downto 0);
variable brkpt_mode_i : std_logic;
variable brkpt_mode_ar : std_logic;
variable brkpt_mode_aw : std_logic;
begin
tmp := '0';
active := '0';
status := (others => '0');
if (brkpt_enable = '1') then
for i in 0 to 3 loop
brkpt_addr := brkpt_reg(i * 20 + 15 downto i * 20);
@ -225,23 +227,27 @@ begin
if (Addr = brkpt_addr) then
if (Sync = '1') then
if (brkpt_mode_i = '1') then
tmp := '1';
active := '1';
status := "0001" & brkpt_reg(i * 20 + 15 downto i * 20);
end if;
else
if (RNW = '1') then
if (brkpt_mode_ar = '1') then
tmp := '1';
active := '1';
status := "0010" & brkpt_reg(i * 20 + 15 downto i * 20);
end if;
else
if (brkpt_mode_aw = '1') then
tmp := '1';
active := '1';
status := "0100" & brkpt_reg(i * 20 + 15 downto i * 20);
end if;
end if;
end if;
end if;
end loop;
end if;
brkpt_active <= tmp;
brkpt_active <= active;
brkpt_status <= status;
end process;
-- 6502 Control
@ -287,6 +293,9 @@ begin
addr_inst <= Addr;
end if;
if (brkpt_active = '1') then
brkpt_status_latched <= brkpt_status;
end if;
brkpt_active1 <= brkpt_active;
-- Single Stepping