Bug 918

Summary: pysvp64dis: introduce single source of truth for instructions (instruction database)
Product: Libre-SOC's first SoC Reporter: Dmitry Selyutin <ghostmansd>
Component: Source CodeAssignee: Dmitry Selyutin <ghostmansd>
Status: RESOLVED FIXED    
Severity: enhancement CC: libre-soc-bugs, lkcl, programmerjake
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Linux   
See Also: https://bugs.libre-soc.org/show_bug.cgi?id=950
NLnet milestone: --- total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation:
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:
Bug Depends on:    
Bug Blocks: 917    

Description Dmitry Selyutin 2022-09-01 09:29:58 BST
All the information about the instructions is scattered between many places, including different kinds of CSVs, fields.text, plus many customizations directly in the code. Let's introduce the single source of truth, something which can act as an instruction database.
Comment 1 Jacob Lifshay 2022-09-01 09:32:25 BST
imho that single source of truth should be something like a folder, we have waay too much pseudo-code to put it all in one file.
Comment 2 Dmitry Selyutin 2022-09-01 09:41:37 BST
Here I actually meant power_insn.py module, which combines the various chunks into some objects; however, perhaps the way the information bits are stored can also be reconsidered.
Comment 3 Jacob Lifshay 2022-09-01 09:47:59 BST
(In reply to Dmitry Selyutin from comment #2)
> Here I actually meant power_insn.py module, which combines the various
> chunks into some objects;
ah, thought you meant files, or like a sqlite database (imho a terrible idea)

> however, perhaps the way the information bits are
> stored can also be reconsidered.

imho all we need in terms of files it's stored in is to have the information properly in the .mdwn, fields.txt, and .csv files, none of the python files should need special cases for particular instructions.
Comment 4 Jacob Lifshay 2022-09-01 09:53:26 BST
(In reply to Jacob Lifshay from comment #3)
> imho all we need in terms of files it's stored in is to have the information
> properly in the .mdwn, fields.txt, and .csv files, none of the python files
> should need special cases for particular instructions.

especially the special cases for large groups of instructions, such as overflow handling:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/power_decoder2.py;hb=49330f613dfb6d0d25677d5e5539df0670be277c#l585

smaller special cases such as svstep needing SVi subtracting 1 when assembling are more ok imho.
Comment 5 Dmitry Selyutin 2022-09-01 09:56:53 BST
I called it a database since I'm terrible at naming. :-) Basically this is a module which simply combines the information from multiple sources into something sensible.
Comment 6 Dmitry Selyutin 2023-04-27 16:10:12 BST
It seems we should close this one as fixed.