Bug 477 - add add instructions to power-instruction-analyzer
Summary: add add instructions to power-instruction-analyzer
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: Other Linux
: --- enhancement
Assignee: Jacob Lifshay
URL:
Depends on:
Blocks:
 
Reported: 2020-08-27 21:29 BST by Jacob Lifshay
Modified: 2020-12-14 19:32 GMT (History)
3 users (show)

See Also:
NLnet milestone: NLNet.2019.10.Wishbone
total budget (EUR) for completion of task and all subtasks: 250
budget (EUR) for this task, excluding subtasks' budget: 250
parent task for budget allocation: 383
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:
jacob={amount=250,paid=2020-12-09}


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Lifshay 2020-08-27 21:29:34 BST
Add `add` instructions to power-instruction-analyzer
Comment 1 Luke Kenneth Casson Leighton 2020-08-27 22:06:18 BST
all of these are broken down into *one* micro-op: add.

it might be worthwhile writing a generator from the CSV files to create the different variants, of which there are a *lot*.
Comment 2 Jacob Lifshay 2020-08-27 22:10:03 BST
currently blocked on my not having access to a POWER9 computer to test, due to talos1.libre-soc.org being offline
Comment 3 Luke Kenneth Casson Leighton 2020-08-27 22:23:37 BST
(In reply to Jacob Lifshay from comment #2)
> currently blocked on my not having access to a POWER9 computer to test, due
> to talos1.libre-soc.org being offline

it had switched itself off.  org.open_power.Proc.FSI.Error.MasterDetectionFailure
no idea.  simply powered it back on.
Comment 4 Jacob Lifshay 2020-08-28 02:26:35 BST
add* and subf* are added and working on master.

I'm currently refactoring to support carry flag inputs and outputs, it doesn't yet compile, so my latest changes are pushed to the add-carry-wip branch
Comment 5 Luke Kenneth Casson Leighton 2020-08-28 03:03:35 BST
the usual way is 66 bit add.  bit hard to do on 64 bit hw :)
Comment 6 Jacob Lifshay 2020-08-28 03:11:25 BST
(In reply to Luke Kenneth Casson Leighton from comment #5)
> the usual way is 66 bit add.  bit hard to do on 64 bit hw :)

I have no issues with the actual arithmetic operations, it's the copying inputs and outputs to/from python and assembly language that is complicated, since I'm using Rust macros to generate a lot of the boilerplate and those assumed that all inputs are 64-bit registers.
Comment 7 Luke Kenneth Casson Leighton 2020-08-28 08:23:13 BST
(wrong bugreport, deleted)
Comment 8 Jacob Lifshay 2020-08-29 02:21:46 BST
I'm working on switching from a macro_rules-based macro for generating the inline assembly and other functions for each instruction to a procedural macro, since it's gotten to the point where rewriting it in normal rust is easier than adding new functionality to the pile of pattern-matching macros I had before.
Comment 9 Jacob Lifshay 2020-09-04 05:09:10 BST
https://salsa.debian.org/Kazan-team/power-instruction-analyzer/-/tree/e828d2acecc25a82d5c29b765163a10993547566

Note that you will probably have to run `rustup upgrade` if you run into compile errors since I'm using some features from a very recent version of rustc.

I finished adding all add-style instructions without immediate operands:
add[o][.]
subf[o][.]
addc[o][.]
subfc[o][.]
adde[o][.]
subfe[o][.]
addme[o][.]
subfme[o][.]
addze[o][.]
subfze[o][.]
addex -- only valid immediate is 0 so I included it
neg[o][.]

addex was *extra* fun to implement since the version of LLVM used in Rust doesn't even support that instruction, so I had to write lots of workarounds.

Adding instructions with immediates is waay more work because the only realistic option to support all immediate values is to JIT compile the instruction once the immediate is known. If we decide that we want to do that, it should be a separate bug report.