Skip to content

Commit

Permalink
apply whitespace trimming to existing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Mar 22, 2024
1 parent 3d5d24f commit 0455062
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 70 deletions.
4 changes: 2 additions & 2 deletions aslp-cpp/test/source/aslp-cpp_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <string>

#include "aslp-cpp/aslp-cpp.hpp"
#include <iostream>
#include <iostream>

auto main() -> int
{
Expand All @@ -13,7 +13,7 @@ auto main() -> int
} catch (std::runtime_error &e) {
std::cout << " error " << e.what() << "\n";
return 1;
}
}


return 0;
Expand Down
16 changes: 8 additions & 8 deletions bin/asli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ let rec process_command (tcenv: TC.Env.t) (cpu: Cpu.cpu) (fname: string) (input0
let cpu' = Cpu.mkCPU cpu.env cpu.denv in
cpu'.gen iset id backend dir
| ":dump" :: iset :: opcode :: rest ->
let fname =
(match rest with
let fname =
(match rest with
| [] -> "sem.aslb"
| [x] -> x
| [x] -> x
| _ -> invalid_arg "expected at most 3 arguments to :dump")
in
let cpu' = Cpu.mkCPU (Eval.Env.copy cpu.env) cpu.denv in
Expand Down Expand Up @@ -350,15 +350,15 @@ let _ =

let main () =
if !opt_print_version then Printf.printf "%s\n" version
else if !opt_print_aarch64_dir then
match aarch64_asl_dir with
else if !opt_print_aarch64_dir then
match aarch64_asl_dir with
| Some d -> Printf.printf "%s\n" d
| None -> (Printf.eprintf "Unable to retrieve installed asl directory\n"; exit 1)
else begin
if !opt_verbose then List.iter print_endline banner;
if !opt_verbose then print_endline "\nType :? for help";
let env_opt =
if (!opt_no_default_aarch64)
if (!opt_no_default_aarch64)
then evaluation_environment !opt_prelude !opt_filenames !opt_verbose
else begin
if List.length (!opt_filenames) != 0 then
Expand All @@ -368,7 +368,7 @@ let main () =
else ();
aarch64_evaluation_environment ~verbose:!opt_verbose ();
end in
let env = (match env_opt with
let env = (match env_opt with
| Some e -> e
| None -> failwith "Unable to build evaluation environment.") in
if not !opt_no_default_aarch64 then
Expand All @@ -378,7 +378,7 @@ let main () =

LNoise.history_load ~filename:"asl_history" |> ignore;
LNoise.history_set ~max_length:100 |> ignore;

let denv = Dis.build_env env in
let prj_files = List.filter (fun f -> Utils.endswith f ".prj") !opt_filenames in
let tcenv = TC.Env.mkEnv TC.env0 and cpu = Cpu.mkCPU env denv in
Expand Down
2 changes: 1 addition & 1 deletion bin/offline_coverage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let rec process_command tcenv env cmd =
| [""] -> ()
| _ -> Printf.printf "Ignoring: %s\n" cmd

let main () =
let main () =
let opt_verbose = ref false in
let env = match Eval.aarch64_evaluation_environment ~verbose:!opt_verbose () with
| Some e -> e
Expand Down
2 changes: 1 addition & 1 deletion bin/offline_sem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let _ =
(fun s -> opt_instr := (!opt_instr) @ [s])
usage_msg

let main () =
let main () =
List.map (fun instr -> run instr) !opt_instr

let _ = main()
4 changes: 2 additions & 2 deletions libASL/decoder_program.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let enc_expr opcode =
| Opcode_Bits b -> expr_in_bits (Expr_Var enc) b
| Opcode_Mask m -> expr_in_mask (Expr_Var enc) m

let enc_slice lo wd =
let enc_slice lo wd =
Expr_Slices (Expr_Var enc, [Slice_LoWd (expr_of_int lo, expr_of_int wd)])

let field_extract loc (IField_Field (f, lo, wd)) =
Expand Down Expand Up @@ -89,7 +89,7 @@ let rec decode_case vs (DecoderAlt_Alt (ps, b)) =
| DecoderBody_UNPRED loc -> ([Stmt_Dep_Unpred(loc)], [])
| DecoderBody_UNALLOC loc -> ([Stmt_Undefined(loc)], [])
| DecoderBody_NOP loc -> ([], [])
| DecoderBody_Encoding(nm, loc) ->
| DecoderBody_Encoding(nm, loc) ->
let test_fn = get_test_fn nm in
let body_fn = get_body_fn nm in
let test = Expr_TApply (test_fn, [], [Expr_Var enc]) in
Expand Down
4 changes: 2 additions & 2 deletions libASL/dis_tc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ let prim_type fi targs =

let get_ret_type f targs env =
match Eval.Env.getFun Unknown env f with
| (Some ty,_,targs_s,_,_,_) ->
| (Some ty,_,targs_s,_,_,_) ->
let subst = List.fold_right2 Bindings.add targs_s targs Bindings.empty in
Some (subst_type subst ty)
| _ -> None
Expand All @@ -128,6 +128,6 @@ let infer_type (e: expr) vars env =
| Expr_TApply(FIdent("extract_int", 0), _, [_;_;w]) -> (Some(Type_Bits(w)))
| Expr_TApply(f, targs, args) ->
(match prim_type f targs with
| Some t -> Some t
| Some t -> Some t
| None -> get_ret_type f targs env)
| _ -> None
24 changes: 12 additions & 12 deletions libASL/eval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1312,46 +1312,46 @@ end



let evaluation_environment (prelude: string) (files: string list) (verbose: bool) =
let evaluation_environment (prelude: string) (files: string list) (verbose: bool) =
let t = LoadASL.read_file prelude true verbose in
let ts = List.map (fun filename ->
if Utils.endswith filename ".spec" then begin
LoadASL.read_spec filename verbose
LoadASL.read_spec filename verbose
end else if Utils.endswith filename ".asl" then begin
LoadASL.read_file filename false verbose
LoadASL.read_file filename false verbose
end else if Utils.endswith filename ".prj" then begin
[] (* ignore project files here and process later *)
end else begin
failwith ("Unrecognized file suffix on "^filename)
end
) files
) files
in
if verbose then Printf.printf "Building evaluation environment\n";
(try
Some (build_evaluation_environment (List.concat (t::ts)))
with
| Value.EvalError (loc, msg) ->
Printf.printf " %s: Evaluation error: %s\n" (pp_loc loc) msg;
Printf.printf " %s: Evaluation error: %s\n" (pp_loc loc) msg;
None
)

let aarch64_asl_dir: string option =
let aarch64_asl_dir: string option =
List.nth_opt Res.Sites.aslfiles 0

let aarch64_asl_files: (string * string list) option =
let aarch64_file_load_order =
let aarch64_asl_files: (string * string list) option =
let aarch64_file_load_order =
["mra_tools/arch/regs.asl"; "mra_tools/types.asl"; "mra_tools/arch/arch.asl"; "mra_tools/arch/arch_instrs.asl"; "mra_tools/arch/regs_access.asl";
"mra_tools/arch/arch_decode.asl"; "mra_tools/support/aes.asl"; "mra_tools/support/barriers.asl"; "mra_tools/support/debug.asl";
"mra_tools/support/feature.asl"; "mra_tools/support/hints.asl"; "mra_tools/support/interrupts.asl"; "mra_tools/support/memory.asl";
"mra_tools/arch/arch_decode.asl"; "mra_tools/support/aes.asl"; "mra_tools/support/barriers.asl"; "mra_tools/support/debug.asl";
"mra_tools/support/feature.asl"; "mra_tools/support/hints.asl"; "mra_tools/support/interrupts.asl"; "mra_tools/support/memory.asl";
"mra_tools/support/stubs.asl"; "mra_tools/support/fetchdecode.asl"; "tests/override.asl"; "tests/override.prj"]
in Option.bind aarch64_asl_dir (fun dir ->
let filenames = List.map (Filename.concat dir) aarch64_file_load_order in
let prelude = Filename.concat dir "prelude.asl" in
Some (prelude, filenames))

(** XXX: .prj files NOT evaluated in this environment! *)
let aarch64_evaluation_environment ?(verbose = false) (): Env.t option =
Option.bind aarch64_asl_files
let aarch64_evaluation_environment ?(verbose = false) (): Env.t option =
Option.bind aarch64_asl_files
(fun (prelude, filenames) -> evaluation_environment prelude filenames verbose)

(****************************************************************
Expand Down
4 changes: 2 additions & 2 deletions libASL/ocaml_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ let write_fn name (ret_tyo,_,targs,args,_,body) st =
* Directory Setup
****************************************************************)

let init_st oc = { depth = 0; skip_seq = false; oc ; ref_vars = IdentSet.empty }
let init_st oc = { depth = 0; skip_seq = false; oc ; ref_vars = IdentSet.empty }
let global_deps = ["Utils"]

(* Write an instruction file, containing just the behaviour of one instructions *)
Expand Down Expand Up @@ -367,7 +367,7 @@ let write_decoder_file fn fnsig deps dir =
write_fn fn fnsig st;
write_epilogue fn st;
close_out oc;
m
m

(* Write the dune build file *)
let write_dune_file files dir =
Expand Down
2 changes: 1 addition & 1 deletion libASL/offline_transform.ml
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ and gen_expr loc e : (taint * expr) wrm =
let@ lo = lt_expr loc lo in
let@ wd = lt_expr loc wd in
gen_slice_expr e lo wd
| Expr_TApply(f,tes,es) ->
| Expr_TApply(f,tes,es) ->
gen_prim loc f tes es

(* State loads *)
Expand Down
4 changes: 2 additions & 2 deletions libASL/primops.ml
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ let clear_ram (mem: ram) (d: char): unit =
mem.contents <- Pages.empty;
mem.default <- Some d

let defaultByte_ram (mem: ram) (addr: bigint): char =
match mem.default with
let defaultByte_ram (mem: ram) (addr: bigint): char =
match mem.default with
| None -> Char.chr Z.(to_int ((extract addr 0 8) lxor (extract addr 8 8)))
| Some c -> c

Expand Down
Loading

0 comments on commit 0455062

Please sign in to comment.