Semantics for RISC code
This commit is contained in:
@ -179,13 +179,15 @@ and convert_a (prg: Types.a_exp) : SimpleStatements.simpleArithmetic =
|
||||
| Division (a1, a2) -> SimpleDivision (convert_a a1, convert_a a2)
|
||||
| Modulo (a1, a2) -> SimpleModulo (convert_a a1, convert_a a2)
|
||||
| Power (a1, a2) -> SimplePower (convert_a a1, convert_a a2)
|
||||
| PowerMod (a1, a2, a3) -> SimplePowerMod (convert_a a1, convert_a a2, convert_a a3)
|
||||
| PowerMod (_) -> failwith "Cannot convert PowerMod into Simple Instruction"
|
||||
| Rand (a) -> SimpleRand (convert_a a)
|
||||
|
||||
let convert (prg: Types.p_exp) : SSCfg.t =
|
||||
let prg = ReplacePowerMod.rewrite_instructions prg in
|
||||
match prg with
|
||||
| Main (i, o, exp) ->
|
||||
{(convert_c SSCfg.empty exp) with inputOutputVar = Some (i, o)}
|
||||
|
||||
let convert_io (prg: Types.p_exp) (i: int) : SSCfg.t =
|
||||
let convert_io (i: int) (prg: Types.p_exp) : SSCfg.t =
|
||||
let prg = ReplacePowerMod.rewrite_instructions prg in
|
||||
{(convert prg) with inputVal = Some i}
|
||||
|
||||
Reference in New Issue
Block a user