aboutsummaryrefslogtreecommitdiff
path: root/model/riscv_csr_end.sail
blob: 5075e2b2fc538b15a6c32072109d593add8b5756 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*=======================================================================================*/
/*  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                                                */
/*=======================================================================================*/

mapping clause csr_name_map = reg <-> hex_bits_12(reg)
end csr_name_map

/* XXX due to an apparent Sail bug the definition of this function must appear
   after the last csr_name_map clause and not by the val spec as it was
   previously. */
function csr_name(csr) = csr_name_map(csr)

function clause is_CSR_defined(_) = false
end is_CSR_defined

function clause read_CSR(csr) = {
   // This should be impossible because is_CSR_defined() should have returned false.
   internal_error(__FILE__, __LINE__, "Read from CSR that does not exist: " ^ bits_str(csr));
}
end read_CSR

function clause write_CSR(csr, _) = {
   // This should be impossible because is_CSR_defined() should have returned false.
   internal_error(__FILE__, __LINE__, "Write to CSR that does not exist: " ^ bits_str(csr));
}
end write_CSR