Skip to content

Commit 0a978e0

Browse files
committed
Move sail_current_exception, add unreachable loc
1 parent 1519e5c commit 0a978e0

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/sail_sv_backend/jib_sv.ml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,6 @@ module Make (Config : CONFIG) = struct
284284
)
285285
^^ space ^^ sv_type_id id ^^ semi
286286
| CTD_variant (id, ctors) ->
287-
let exception_boilerplate =
288-
if Id.compare id (mk_id "exception") = 0 then
289-
twice hardline ^^ ksprintf string "%s sail_current_exception;" (sv_type_id_string id)
290-
else empty
291-
in
292287
let kind_id (id, _) = string_of_id id |> Util.zencode_string |> String.uppercase_ascii |> string in
293288
let sv_ctor (id, ctyp) = wrap_type ctyp (sv_id id) in
294289
let tag_type = string ("sailtag_" ^ sv_id_string id) in
@@ -442,7 +437,6 @@ module Make (Config : CONFIG) = struct
442437
]
443438
^^ twice hardline
444439
^^ separate (twice hardline) constructors
445-
^^ exception_boilerplate
446440
)
447441
else (
448442
let constructors =
@@ -483,7 +477,6 @@ module Make (Config : CONFIG) = struct
483477
]
484478
^^ twice hardline
485479
^^ separate (twice hardline) constructors
486-
^^ exception_boilerplate
487480
)
488481

489482
let sv_signed x = string "signed'" ^^ parens x

src/sail_sv_backend/sail_plugin_sv.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ let verilog_target _ default_sail_dir out_opt ast effect_info env =
422422
in
423423

424424
let exception_vars =
425-
string "logic sail_reached_unreachable;" ^^ hardline ^^ string "logic sail_have_exception;" ^^ hardline
425+
string "t_exception sail_current_exception;" ^^ hardline ^^
426+
string "logic sail_reached_unreachable;" ^^ hardline ^^
427+
string "logic [31:0] sail_reached_unreachable_loc;" ^^ string "logic sail_have_exception;" ^^ hardline
426428
^^ (if !opt_nostrings then string "sail_unit" else string "string")
427429
^^ space ^^ string "sail_throw_location;" ^^ twice hardline
428430
in
@@ -468,7 +470,7 @@ let verilog_target _ default_sail_dir out_opt ast effect_info env =
468470
^^ string "return " ^^ result ^^ slot_index ^^ string ";"
469471
) ^^ hardline ^^ string "end" ^^ hardline
470472
in
471-
let fun_body = concat (List.init slots fun_body_slot) ^^ string "sail_reached_unreachable = 1;" in
473+
let fun_body = concat (List.init slots fun_body_slot) ^^ string "sail_reached_unreachable = 1;" ^^ hardline ^^ string "sail_reached_unreachable_loc = `__LINE__;" in
472474
let slot_ranges = string ("[" ^ string_of_int slots ^ "]") in
473475
( sv_fundef_with ctx real_name arg_nms arg_typs ret_ty fun_body ^^ twice hardline,
474476
separate space [string "output"; string "logic"; invoke_flag ^^ slot_ranges]

0 commit comments

Comments
 (0)