@@ -62,12 +62,12 @@ function clause execute (JAL(imm, rd)) = {
62
62
let target = PC + sign_extend (imm );
63
63
/* Extensions get the first checks on the prospective target address. */
64
64
match ext_control_check_pc (target ) {
65
- Ext_ControlAddr_Error (e ) => RETIRE_FAIL ( Ext_ControlAddr_Check_Failure (e ) ),
65
+ Ext_ControlAddr_Error (e ) => Ext_ControlAddr_Check_Failure (e ),
66
66
Ext_ControlAddr_OK (target ) => {
67
67
/* Perform standard alignment check */
68
68
let target_bits = bits_of (target );
69
69
if bit_to_bool (target_bits [1 ]) & not (currentlyEnabled (Ext_Zca )) then {
70
- RETIRE_FAIL ( Memory_Exception (target , E_Fetch_Addr_Align () ))
70
+ Memory_Exception (target , E_Fetch_Addr_Align ())
71
71
} else {
72
72
X (rd ) = get_next_pc ();
73
73
set_next_pc (target_bits );
@@ -121,11 +121,11 @@ function clause execute (BTYPE(imm, rs2, rs1, op)) = {
121
121
let target = PC + sign_extend (imm );
122
122
/* Extensions get the first checks on the prospective target address. */
123
123
match ext_control_check_pc (target ) {
124
- Ext_ControlAddr_Error (e ) => RETIRE_FAIL ( Ext_ControlAddr_Check_Failure (e ) ),
124
+ Ext_ControlAddr_Error (e ) => Ext_ControlAddr_Check_Failure (e ),
125
125
Ext_ControlAddr_OK (target ) => {
126
126
let target_bits = bits_of (target );
127
127
if bit_to_bool (target_bits [1 ]) & not (currentlyEnabled (Ext_Zca )) then {
128
- RETIRE_FAIL ( Memory_Exception (target , E_Fetch_Addr_Align () ))
128
+ Memory_Exception (target , E_Fetch_Addr_Align ())
129
129
} else {
130
130
set_next_pc (target_bits );
131
131
RETIRE_SUCCESS
@@ -305,16 +305,16 @@ function clause execute (LOAD(imm, rs1, rd, is_unsigned, width, aq, rl)) = {
305
305
/* Get the address, X(rs1) + offset.
306
306
Some extensions perform additional checks on address validity. */
307
307
match ext_data_get_addr (rs1 , offset , Read (Data ), width_bytes ) {
308
- Ext_DataAddr_Error (e ) => RETIRE_FAIL ( Ext_DataAddr_Check_Failure (e ) ),
308
+ Ext_DataAddr_Error (e ) => Ext_DataAddr_Check_Failure (e ),
309
309
Ext_DataAddr_OK (vaddr ) => {
310
310
if check_misaligned (vaddr , width )
311
- then RETIRE_FAIL ( Memory_Exception (vaddr , E_Load_Addr_Align () ))
311
+ then Memory_Exception (vaddr , E_Load_Addr_Align ())
312
312
else match translateAddr (vaddr , Read (Data )) {
313
- TR_Failure (e , _ ) => RETIRE_FAIL ( Memory_Exception (vaddr , e ) ),
313
+ TR_Failure (e , _ ) => Memory_Exception (vaddr , e ),
314
314
TR_Address (paddr , _ ) =>
315
315
match mem_read (Read (Data ), paddr , width_bytes , aq , rl , false ) {
316
316
Ok (result ) => { X (rd ) = extend_value (is_unsigned , result ); RETIRE_SUCCESS },
317
- Err (e ) => RETIRE_FAIL ( Memory_Exception (vaddr , e ) ),
317
+ Err (e ) => Memory_Exception (vaddr , e ),
318
318
},
319
319
}
320
320
},
@@ -361,21 +361,21 @@ function clause execute (STORE(imm, rs2, rs1, width, aq, rl)) = {
361
361
/* Get the address, X(rs1) + offset.
362
362
Some extensions perform additional checks on address validity. */
363
363
match ext_data_get_addr (rs1 , offset , Write (Data ), width_bytes ) {
364
- Ext_DataAddr_Error (e ) => RETIRE_FAIL ( Ext_DataAddr_Check_Failure (e ) ),
364
+ Ext_DataAddr_Error (e ) => Ext_DataAddr_Check_Failure (e ),
365
365
Ext_DataAddr_OK (vaddr ) =>
366
366
if check_misaligned (vaddr , width )
367
- then RETIRE_FAIL ( Memory_Exception (vaddr , E_SAMO_Addr_Align () ))
367
+ then Memory_Exception (vaddr , E_SAMO_Addr_Align ())
368
368
else match translateAddr (vaddr , Write (Data )) {
369
- TR_Failure (e , _ ) => RETIRE_FAIL ( Memory_Exception (vaddr , e ) ),
369
+ TR_Failure (e , _ ) => Memory_Exception (vaddr , e ),
370
370
TR_Address (paddr , _ ) => {
371
371
match mem_write_ea (paddr , width_bytes , aq , rl , false ) {
372
- Err (e ) => RETIRE_FAIL ( Memory_Exception (vaddr , e ) ),
372
+ Err (e ) => Memory_Exception (vaddr , e ),
373
373
Ok (_ ) => {
374
374
let rs2_val = X (rs2 );
375
375
match mem_write_value (paddr , width_bytes , rs2_val [width_bytes * 8 - 1 .. 0 ], aq , rl , false ) {
376
376
Ok (true ) => RETIRE_SUCCESS ,
377
377
Ok (false ) => internal_error (__FILE__, __LINE__, "store got false from mem_write_value" ),
378
- Err (e ) => RETIRE_FAIL ( Memory_Exception (vaddr , e ) )
378
+ Err (e ) => Memory_Exception (vaddr , e )
379
379
}
380
380
}
381
381
}
@@ -584,7 +584,7 @@ function clause execute ECALL() = {
584
584
},
585
585
excinfo = (None () : option (xlenbits )),
586
586
ext = None () };
587
- RETIRE_FAIL ( Trap (cur_privilege , CTL_TRAP (t ), PC ) )
587
+ Trap (cur_privilege , CTL_TRAP (t ), PC )
588
588
}
589
589
590
590
mapping clause assembly = ECALL () <-> "ecall"
@@ -597,9 +597,9 @@ mapping clause encdec = MRET()
597
597
598
598
function clause execute MRET () = {
599
599
if cur_privilege != Machine
600
- then RETIRE_FAIL ( Illegal_Instruction () )
600
+ then Illegal_Instruction ()
601
601
else if not (ext_check_xret_priv (Machine ))
602
- then RETIRE_FAIL ( Ext_XRET_Priv_Failure () )
602
+ then Ext_XRET_Priv_Failure ()
603
603
else {
604
604
set_next_pc (exception_handler (cur_privilege , CTL_MRET (), PC ));
605
605
RETIRE_SUCCESS
@@ -621,9 +621,9 @@ function clause execute SRET() = {
621
621
Machine => not (currentlyEnabled (Ext_S ))
622
622
};
623
623
if sret_illegal
624
- then RETIRE_FAIL ( Illegal_Instruction () )
624
+ then Illegal_Instruction ()
625
625
else if not (ext_check_xret_priv (Supervisor ))
626
- then RETIRE_FAIL ( Ext_XRET_Priv_Failure () )
626
+ then Ext_XRET_Priv_Failure ()
627
627
else {
628
628
set_next_pc (exception_handler (cur_privilege , CTL_SRET (), PC ));
629
629
RETIRE_SUCCESS
@@ -639,7 +639,7 @@ mapping clause encdec = EBREAK()
639
639
<-> 0b000000000001 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011
640
640
641
641
function clause execute EBREAK () =
642
- RETIRE_FAIL ( Memory_Exception (Virtaddr (PC ), E_Breakpoint () ))
642
+ Memory_Exception (Virtaddr (PC ), E_Breakpoint ())
643
643
644
644
mapping clause assembly = EBREAK () <-> "ebreak"
645
645
@@ -651,11 +651,11 @@ mapping clause encdec = WFI()
651
651
652
652
function clause execute WFI () =
653
653
match cur_privilege {
654
- Machine => RETIRE_FAIL ( Wait_For_Interrupt () ),
654
+ Machine => Wait_For_Interrupt (),
655
655
Supervisor => if mstatus [TW ] == 0b1
656
- then RETIRE_FAIL ( Illegal_Instruction () )
657
- else RETIRE_FAIL ( Wait_For_Interrupt () ),
658
- User => RETIRE_FAIL ( Illegal_Instruction () )
656
+ then Illegal_Instruction ()
657
+ else Wait_For_Interrupt (),
658
+ User => Illegal_Instruction ()
659
659
}
660
660
661
661
mapping clause assembly = WFI () <-> "wfi"
@@ -673,9 +673,9 @@ function clause execute SFENCE_VMA(rs1, rs2) = {
673
673
// is 9 but we always set it to 16 for RV64.
674
674
let asid = if rs2 != zreg then Some (X (rs2 )[asidlen - 1 .. 0 ]) else None ();
675
675
match cur_privilege {
676
- User => RETIRE_FAIL ( Illegal_Instruction () ),
676
+ User => Illegal_Instruction (),
677
677
Supervisor => match mstatus [TVM ] {
678
- 0b1 => RETIRE_FAIL ( Illegal_Instruction () ),
678
+ 0b1 => Illegal_Instruction (),
679
679
0b0 => { flush_TLB (asid , addr ); RETIRE_SUCCESS },
680
680
},
681
681
Machine => { flush_TLB (asid , addr ); RETIRE_SUCCESS }
0 commit comments