add PowerISA decoder #7

Merged
programmerjake merged 35 commits from programmerjake/cpu:add-powerisa-decoder into master 2026-01-29 02:22:14 +00:00
Fixes: https://git.libre-chip.org/libre-chip/grant-tracking/issues/12
programmerjake added 8 commits 2026-01-19 06:53:43 +00:00
programmerjake added 1 commit 2026-01-19 07:24:12 +00:00
update reg_alloc.vcd
All checks were successful
/ test (pull_request) Successful in 27m28s
62a330ed4d
programmerjake added 3 commits 2026-01-20 04:10:21 +00:00
programmerjake added 1 commit 2026-01-20 06:39:39 +00:00
add tests for and fix decoding branch instructions
All checks were successful
/ test (pull_request) Successful in 27m1s
85ada6e55a
programmerjake added 2 commits 2026-01-21 00:20:59 +00:00
programmerjake added 2 commits 2026-01-22 15:35:20 +00:00
programmerjake added 1 commit 2026-01-22 16:29:24 +00:00
fix & clean up MOp definitions and ensure_reg_fields_are_in_the_same_place
All checks were successful
/ test (pull_request) Successful in 28m22s
e6f876f9af
programmerjake added 5 commits 2026-01-23 19:47:26 +00:00
programmerjake added 2 commits 2026-01-23 20:13:21 +00:00
programmerjake added 1 commit 2026-01-24 00:08:06 +00:00
programmerjake added 1 commit 2026-01-25 23:07:06 +00:00
programmerjake added 2 commits 2026-01-26 04:35:18 +00:00
programmerjake added 2 commits 2026-01-27 00:13:45 +00:00
programmerjake added 3 commits 2026-01-28 03:20:28 +00:00
programmerjake added 1 commit 2026-01-29 01:35:25 +00:00
implement decoding mtspr/mfspr/mftb
All checks were successful
/ test (pull_request) Successful in 31m50s
/ test (push) Successful in 32m14s
f88346ea37
programmerjake changed title from WIP: add PowerISA decoder to add PowerISA decoder 2026-01-29 01:37:35 +00:00
Author
Owner

The decoder handles decoding either 32 or 64-bit (prefixed) instructions, and for each instruction generates 0-3 µOps:

  • no-ops decode to 0 µOps
  • most instructions decode to 1 µOp
  • loads and stores decode to 2 µOps
  • branch-and-decrement-ctr instructions decode to 2 µOps
  • store-update instructions with all register arguments being the same register need 3 µOps for:
    • calculate the address into a temporary
    • do the store
    • move from the temporary into the updated register.

I've implemented decoding most of the simple branch and integer instructions:

  • b[l][a]
  • bc[l][a]/bclr[l]/bcctr[l]/bctar[l]
  • crand/crnand/cror/crxor/crnor/creqv/crandc/crorc
  • mcrf
  • lbz[u][x]/plbz
  • lh[za][u][x]/plhz
  • lw[za][u][x]/plwz
  • ld[u][x]/pld
  • stb[u][x]/pstb
  • sth[u][x]/psth
  • stw[u][x]/pstw
  • std[u][x]/pstd
  • addi/paddi
  • addis
  • addpcis
  • add[o][.]
  • addic[.]
  • subf[o][.]
  • subfic
  • addc[o][.]
  • subfc[o][.]
  • adde[o][.]
  • subfe[o][.]
  • addme[o][.]/addze[o][.]/subfme[o][.]/subfze[o][.]
  • neg[o][.]
  • cmp[l][i]
  • cmprb
  • cmpeqb
  • andi./andis./ori/oris/xori/xoris
  • and[.]/xor[.]/nand[.]/or[.]/orc[.]/nor[.]/eqv[.]/andc[.]
  • extsb[.]/extsh[.]/extsw[.]
  • rlwinm[.]/rlwnm[.]/rlwimi[.]/rldicl[.]/rldicr[.]/rldic[.]/rldcl[.]/rldcr[.]/rldimi[.]
  • slw[.]/srw[.]/srawi[.]/sraw[.]/sld[.]/sradi[.]/srd[.]/srad[.]
  • extswsli[.]
  • mtspr/mfspr/mftb -- for LR, CTR, TAR, TB, and TBU.
  • mcrxrx
  • pnop
The decoder handles decoding either 32 or 64-bit (prefixed) instructions, and for each instruction generates 0-3 µOps: * no-ops decode to 0 µOps * most instructions decode to 1 µOp * loads and stores decode to 2 µOps * branch-and-decrement-ctr instructions decode to 2 µOps * store-update instructions with all register arguments being the same register need 3 µOps for: * calculate the address into a temporary * do the store * move from the temporary into the updated register. I've implemented decoding most of the simple branch and integer instructions: * `b[l][a]` * `bc[l][a]`/`bclr[l]`/`bcctr[l]`/`bctar[l]` * `crand`/`crnand`/`cror`/`crxor`/`crnor`/`creqv`/`crandc`/`crorc` * `mcrf` * `lbz[u][x]`/`plbz` * `lh[za][u][x]`/`plhz` * `lw[za][u][x]`/`plwz` * `ld[u][x]`/`pld` * `stb[u][x]`/`pstb` * `sth[u][x]`/`psth` * `stw[u][x]`/`pstw` * `std[u][x]`/`pstd` * `addi`/`paddi` * `addis` * `addpcis` * `add[o][.]` * `addic[.]` * `subf[o][.]` * `subfic` * `addc[o][.]` * `subfc[o][.]` * `adde[o][.]` * `subfe[o][.]` * `addme[o][.]`/`addze[o][.]`/`subfme[o][.]`/`subfze[o][.]` * `neg[o][.]` * `cmp[l][i]` * `cmprb` * `cmpeqb` * `andi.`/`andis.`/`ori`/`oris`/`xori`/`xoris` * `and[.]`/`xor[.]`/`nand[.]`/`or[.]`/`orc[.]`/`nor[.]`/`eqv[.]`/`andc[.]` * `extsb[.]`/`extsh[.]`/`extsw[.]` * `rlwinm[.]`/`rlwnm[.]`/`rlwimi[.]`/`rldicl[.]`/`rldicr[.]`/`rldic[.]`/`rldcl[.]`/`rldcr[.]`/`rldimi[.]` * `slw[.]`/`srw[.]`/`srawi[.]`/`sraw[.]`/`sld[.]`/`sradi[.]`/`srd[.]`/`srad[.]` * `extswsli[.]` * `mtspr`/`mfspr`/`mftb` -- for LR, CTR, TAR, TB, and TBU. * `mcrxrx` * `pnop`
programmerjake merged commit f88346ea37 into master 2026-01-29 02:22:14 +00:00
programmerjake deleted branch add-powerisa-decoder 2026-01-29 02:22:14 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: libre-chip/cpu#7
No description provided.