sy2002 / QNICE-FPGA

QNICE-FPGA is a 16-bit computer system for recreational programming built as a fully-fledged System-on-a-Chip in portable VHDL.
http://qnice-fpga.com
Other
69 stars 15 forks source link

Hardware single step support #127

Open bernd-ulmann opened 4 years ago

bernd-ulmann commented 4 years ago

This issue is part of #67 and issue #66. We (Mirko and I) are thinking about breakpoint and single step support in QNICE and came up with the following idea:

MJoergen commented 4 years ago

The above description details the single step feature. What about the breakpoint feature ?

sy2002 commented 4 years ago

@MJoergen Well you are right: It is a single step feature only. The breakpoints are then implemented in software: If the hardware is able to break at every instruction, your debug ISR can check, i the address equals a breakpoint and/or if some other trigger conditions are met. I renamed the issue now to Hardware single step support.

bernd-ulmann commented 4 years ago

Hi - basically, this feature can also be used for breakpoint handling in one of two ways:

:-)

bernd-ulmann commented 4 years ago

This is just a collection of implementation ideas so that we do not forget what we talked about:

RSR SPC, R0; here R0 is the destination WSR SPC, R0; while it is the source here

bernd-ulmann commented 4 years ago

Change of plan! :-) At least slightly. I suggest (after sleeping over this issue) the following:

What do you think?

sy2002 commented 4 years ago

WOW! Bernd, from time to time you are showing the attributes of a true genius!

This idea is brilliant: Elegant. Non-breaking. (Q)Nice!

I could perfectly live with the slight inconvenience that when you want to make sure that the shadow register is exactly how it was, you always need to exchange twice ("in and out"). Compared with all the advantages I would say: Let's go for this.

Up to you Bernd:

Right now this must not be checked in to develop as we said V1.8. You would create a new branch "dev-v1.8" that we could use for that.

OR: As a non breaking change I would have no problem having this is 1.7 again. Then Bernd could do the Emu and I would enhance the CPU.

Up to you.

bernd-ulmann commented 4 years ago

You are vastly exaggerating, but I am very happy that you like the idea! :-)

If you are OK with it, I will extend the documentation and emulator in the develop branch as it won't break any of our existing code. :-)

sy2002 commented 4 years ago

Absolutely OK. When done please do not close this issue but assign it to me as I need to implement it in hardware.

bernd-ulmann commented 4 years ago

The assembler now understands the EXC instruction, the emulator, too, the documentation is updated, and both disassemblers (that in the emulator and the one in the monitor) also can disassemble the new instruction. Here is a sample code snippet:

include "../dist_kit/sysdef.asm"

    .ORG    0x8000
    MOVE    0x1000, R7
    EXC     SHSP, R7
    HALT
    EXC     SHSP, R7
    HALT
sy2002 commented 4 years ago

Hi Bernd, this issue is about the single step flag, too. Re-assigning...

sy2002 commented 4 years ago

Note to myself: Before closing this one: Volker's VASM does need to support EXC, too.