microwatt icon indicating copy to clipboard operation
microwatt copied to clipboard

Add instruction breakpoint

Open mikey opened this issue 4 years ago • 6 comments

Add a instruction breakpoint to microwatt. When the PC hits this value, take a trace exception at 0xD00.

The ISA defines the CIABR which is the "completed" instruction. This means take the exception after the instruction is run which is not ideal from a software perspective. An implementation that takes the breakpoint before the instruction is executed would be more useful but we'd have to call it an IABR not CIABR.

mikey avatar Jul 08 '20 04:07 mikey

Extra credit for adding single stepping and/or branch tracing via MSR[TE].

mikey avatar Jul 08 '20 04:07 mikey

I've got a bit of a WIP here: https://github.com/iamjpn/microwatt/tree/ciabr

iamjpn avatar Jul 09 '20 03:07 iamjpn

Doesn't actually seem to complete first the instruction though.

What do you mean by that? @iamjpn

mikey avatar Jul 13 '20 01:07 mikey

Doesn't actually seem to complete first the instruction though.

What do you mean by that? @iamjpn

What I mean is that currently the exception is taken before the instruction is completed.

breakpoint:
	addi	%r4, %r4, 1
	b	1f // should be skipped
	//cmpwi	%r4, 1
	//bne	1f

That's why I commented out that cmpwi in the test. I've got to fix that up.

iamjpn avatar Jul 13 '20 10:07 iamjpn

As mentioned in the first comment, it would be useful to have it that way but it's not arch compliant.

mikey avatar Jul 14 '20 12:07 mikey

I reimplemented @iamjpn work for a newer version of the code and wanted to make it arch compliant, but I'm having trouble getting the completed instruction address instead of the next instruction address.

https://github.com/iagocaran/microwatt

iagocaran avatar Jan 10 '23 01:01 iagocaran