Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

[32bit] branch on single bit #170

Open
jnk0le opened this issue Jun 28, 2022 · 2 comments
Open

[32bit] branch on single bit #170

jnk0le opened this issue Jun 28, 2022 · 2 comments
Labels
future idea Something for a future version of the spec

Comments

@jnk0le
Copy link
Contributor

jnk0le commented Jun 28, 2022

very common construct in peripheral/IO bound uC code

if (USART1->ISR & (1 << USART_ISR_RXNE_Pos)) { }

Normally the status bit needs to be extracted by andi or bexti followed by beqz/bnez

we could fuse the bexti + branch at quite low decoding cost

  • addres offset stays the same
  • shamt in place of rs2/imm5 as in beqi/bnei as well as bexti

only downsides are that the BRANCH major op can't fit another 2 branch instructions, and encoding is problematic on RV64.

On RV32E with peripherals mapped to upper GPRs we gain something like AVR8 SBIS/SBIC instruction

@tariqkurd-repo tariqkurd-repo added the future idea Something for a future version of the spec label Jun 29, 2022
@jnk0le
Copy link
Contributor Author

jnk0le commented Dec 4, 2022

made a custom extension around that avr like IO concept: https://github.com/jnk0le/XTightlyCoupledIO

@jnk0le
Copy link
Contributor Author

jnk0le commented Dec 28, 2022

single bit can be tested by slli + bgez so bexti provides no advantage in this scenario

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
future idea Something for a future version of the spec
Projects
None yet
Development

No branches or pull requests

2 participants