RISC code output

TODO: fix wrong order for conversion in cfgrisc
This commit is contained in:
elvis
2024-12-01 12:55:20 +01:00
parent 08f0eb5c91
commit 52cd7e7e13
7 changed files with 332 additions and 11 deletions

56
lib/miniImp/RISC.mli Normal file
View File

@ -0,0 +1,56 @@
module RISCAssembly : sig
type register = {
index : int
}
type label
type risci =
| Nop
| BRegOp of brop * register * register * register
| BImmOp of biop * register * int * register
| URegOp of urop * register * register
| Load of register * register
| LoadI of register * int
| Store of register * register
| Jump of label
| CJump of register * label * label
| Label of label
and brop =
| Add
| Sub
| Mult
| Div
| Mod
| Pow
| And
| Or
| Eq
| Less
| LessEq
| More
| MoreEq
and biop =
| AddI
| SubI
| MultI
| DivI
| ModI
| PowI
| AndI
| OrI
| EqI
| LessI
| LessEqI
| MoreI
| MoreEqI
and urop =
| Not
| Copy
| Rand
type t = risci list
val pp : out_channel -> t -> unit
end
val convert : CfgRISC.RISCCfg.t -> RISCAssembly.t