forked from riscv/sail-riscv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move exception code into its own file
This is not necessary for the model currently, however internally we wanted to use `internal_error` in a file that was before `riscv_types.sail`. Putting it in its own file makes that possible, and I think it's an organisational improvement even if the model currently does not need it.
- Loading branch information
Showing
3 changed files
with
24 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*=======================================================================================*/ | ||
/* This Sail RISC-V architecture model, comprising all files and */ | ||
/* directories except where otherwise noted is subject the BSD */ | ||
/* two-clause license in the LICENSE file. */ | ||
/* */ | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/*=======================================================================================*/ | ||
|
||
/* model-internal exceptions */ | ||
|
||
union exception = { | ||
Error_not_implemented : string, | ||
Error_internal_error : unit | ||
} | ||
|
||
val not_implemented : forall ('a : Type). string -> 'a | ||
function not_implemented message = throw(Error_not_implemented(message)) | ||
|
||
val internal_error : forall ('a : Type). (string, int, string) -> 'a | ||
function internal_error(file, line, s) = { | ||
assert (false, file ^ ":" ^ dec_str(line) ^ ": " ^ s); | ||
throw Error_internal_error() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters