Skip to content

Add Jump With Return instruction #2

Description

@zHoeshin

Basically adding support for calling functions.
Jump with return pushes the PC to the stack(whether accessible elsewhere or not) and jumps.
Return pops the value from the stack and jumps to this value.

Activity

  1. Macpunk commented on Jan 28, 2024

    @Macpunk

    I hope I'm not mistaken, but I didn't see any hardware stack support in this ISA. You could use one of the GPRs to simulate a stack, however. But now we're talking ABI spec.

    Without a TRAN PC, REG/TRAN REG, PC or JMP REG instruction, I can't see a trivial workaround to this issue.

    I suppose you could theoretically implement a RET instruction as a JMP IMM, but before executing that instruction, modify the destination. You'd have a somewhat weird looking epilogue, because self-modifying code sucks, but it should work.

  2. sergiodavies commented on Jan 28, 2024

    @sergiodavies

    Before thinking about a hardware support for the stack, I would implement a TRAN PC / REG and TRAN REG / PC. This would allow a software stack, with little changes to the current architecture. I think the multiplexer on the PC would need updating and accordingly there would be an instruction that could read from PC.

  3. perdo-nober-rs commented on Feb 2, 2024

    @perdo-nober-rs

    I think jump with call not good for excel cpu. excel cpu is already slow, should optimize running code by inlining function instead of having redundant call ret. like shader for gpu do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions