|
2 | 2 |
|
3 | 3 | package freechips.rocketchip.rocket.constants
|
4 | 4 |
|
5 |
| -import Chisel._ |
| 5 | +import chisel3._ |
| 6 | +import chisel3.util._ |
6 | 7 | import freechips.rocketchip.util._
|
7 | 8 |
|
8 | 9 | trait ScalarOpConstants {
|
9 | 10 | val SZ_BR = 3
|
10 | 11 | def BR_X = BitPat("b???")
|
11 |
| - def BR_EQ = UInt(0, 3) |
12 |
| - def BR_NE = UInt(1, 3) |
13 |
| - def BR_J = UInt(2, 3) |
14 |
| - def BR_N = UInt(3, 3) |
15 |
| - def BR_LT = UInt(4, 3) |
16 |
| - def BR_GE = UInt(5, 3) |
17 |
| - def BR_LTU = UInt(6, 3) |
18 |
| - def BR_GEU = UInt(7, 3) |
| 12 | + def BR_EQ = 0.U(3.W) |
| 13 | + def BR_NE = 1.U(3.W) |
| 14 | + def BR_J = 2.U(3.W) |
| 15 | + def BR_N = 3.U(3.W) |
| 16 | + def BR_LT = 4.U(3.W) |
| 17 | + def BR_GE = 5.U(3.W) |
| 18 | + def BR_LTU = 6.U(3.W) |
| 19 | + def BR_GEU = 7.U(3.W) |
19 | 20 |
|
20 | 21 | def A1_X = BitPat("b??")
|
21 |
| - def A1_ZERO = UInt(0, 2) |
22 |
| - def A1_RS1 = UInt(1, 2) |
23 |
| - def A1_PC = UInt(2, 2) |
| 22 | + def A1_ZERO = 0.U(2.W) |
| 23 | + def A1_RS1 = 1.U(2.W) |
| 24 | + def A1_PC = 2.U(2.W) |
24 | 25 |
|
25 | 26 | def IMM_X = BitPat("b???")
|
26 |
| - def IMM_S = UInt(0, 3) |
27 |
| - def IMM_SB = UInt(1, 3) |
28 |
| - def IMM_U = UInt(2, 3) |
29 |
| - def IMM_UJ = UInt(3, 3) |
30 |
| - def IMM_I = UInt(4, 3) |
31 |
| - def IMM_Z = UInt(5, 3) |
| 27 | + def IMM_S = 0.U(3.W) |
| 28 | + def IMM_SB = 1.U(3.W) |
| 29 | + def IMM_U = 2.U(3.W) |
| 30 | + def IMM_UJ = 3.U(3.W) |
| 31 | + def IMM_I = 4.U(3.W) |
| 32 | + def IMM_Z = 5.U(3.W) |
32 | 33 |
|
33 | 34 | def A2_X = BitPat("b??")
|
34 |
| - def A2_ZERO = UInt(0, 2) |
35 |
| - def A2_SIZE = UInt(1, 2) |
36 |
| - def A2_RS2 = UInt(2, 2) |
37 |
| - def A2_IMM = UInt(3, 2) |
| 35 | + def A2_ZERO = 0.U(2.W) |
| 36 | + def A2_SIZE = 1.U(2.W) |
| 37 | + def A2_RS2 = 2.U(2.W) |
| 38 | + def A2_IMM = 3.U(2.W) |
38 | 39 |
|
39 | 40 | def X = BitPat("b?")
|
40 | 41 | def N = BitPat("b0")
|
41 | 42 | def Y = BitPat("b1")
|
42 | 43 |
|
43 | 44 | val SZ_DW = 1
|
44 | 45 | def DW_X = X
|
45 |
| - def DW_32 = Bool(false) |
46 |
| - def DW_64 = Bool(true) |
| 46 | + def DW_32 = false.B |
| 47 | + def DW_64 = true.B |
47 | 48 | def DW_XPR = DW_64
|
48 | 49 | }
|
49 | 50 |
|
50 | 51 | trait MemoryOpConstants {
|
51 | 52 | val NUM_XA_OPS = 9
|
52 | 53 | val M_SZ = 5
|
53 | 54 | def M_X = BitPat("b?????");
|
54 |
| - def M_XRD = UInt("b00000"); // int load |
55 |
| - def M_XWR = UInt("b00001"); // int store |
56 |
| - def M_PFR = UInt("b00010"); // prefetch with intent to read |
57 |
| - def M_PFW = UInt("b00011"); // prefetch with intent to write |
58 |
| - def M_XA_SWAP = UInt("b00100"); |
59 |
| - def M_FLUSH_ALL = UInt("b00101") // flush all lines |
60 |
| - def M_XLR = UInt("b00110"); |
61 |
| - def M_XSC = UInt("b00111"); |
62 |
| - def M_XA_ADD = UInt("b01000"); |
63 |
| - def M_XA_XOR = UInt("b01001"); |
64 |
| - def M_XA_OR = UInt("b01010"); |
65 |
| - def M_XA_AND = UInt("b01011"); |
66 |
| - def M_XA_MIN = UInt("b01100"); |
67 |
| - def M_XA_MAX = UInt("b01101"); |
68 |
| - def M_XA_MINU = UInt("b01110"); |
69 |
| - def M_XA_MAXU = UInt("b01111"); |
70 |
| - def M_FLUSH = UInt("b10000") // write back dirty data and cede R/W permissions |
71 |
| - def M_PWR = UInt("b10001") // partial (masked) store |
72 |
| - def M_PRODUCE = UInt("b10010") // write back dirty data and cede W permissions |
73 |
| - def M_CLEAN = UInt("b10011") // write back dirty data and retain R/W permissions |
74 |
| - def M_SFENCE = UInt("b10100") // SFENCE.VMA |
75 |
| - def M_HFENCEV = UInt("b10101") // HFENCE.VVMA |
76 |
| - def M_HFENCEG = UInt("b10110") // HFENCE.GVMA |
77 |
| - def M_WOK = UInt("b10111") // check write permissions but don't perform a write |
78 |
| - def M_HLVX = UInt("b10000") // HLVX instruction |
| 55 | + def M_XRD = "b00000".U; // int load |
| 56 | + def M_XWR = "b00001".U; // int store |
| 57 | + def M_PFR = "b00010".U; // prefetch with intent to read |
| 58 | + def M_PFW = "b00011".U; // prefetch with intent to write |
| 59 | + def M_XA_SWAP = "b00100".U |
| 60 | + def M_FLUSH_ALL = "b00101".U // flush all lines |
| 61 | + def M_XLR = "b00110".U |
| 62 | + def M_XSC = "b00111".U |
| 63 | + def M_XA_ADD = "b01000".U |
| 64 | + def M_XA_XOR = "b01001".U |
| 65 | + def M_XA_OR = "b01010".U |
| 66 | + def M_XA_AND = "b01011".U |
| 67 | + def M_XA_MIN = "b01100".U |
| 68 | + def M_XA_MAX = "b01101".U |
| 69 | + def M_XA_MINU = "b01110".U |
| 70 | + def M_XA_MAXU = "b01111".U |
| 71 | + def M_FLUSH = "b10000".U // write back dirty data and cede R/W permissions |
| 72 | + def M_PWR = "b10001".U // partial (masked) store |
| 73 | + def M_PRODUCE = "b10010".U // write back dirty data and cede W permissions |
| 74 | + def M_CLEAN = "b10011".U // write back dirty data and retain R/W permissions |
| 75 | + def M_SFENCE = "b10100".U // SFENCE.VMA |
| 76 | + def M_HFENCEV = "b10101".U // HFENCE.VVMA |
| 77 | + def M_HFENCEG = "b10110".U // HFENCE.GVMA |
| 78 | + def M_WOK = "b10111".U // check write permissions but don't perform a write |
| 79 | + def M_HLVX = "b10000".U // HLVX instruction |
79 | 80 |
|
80 | 81 | def isAMOLogical(cmd: UInt) = cmd.isOneOf(M_XA_SWAP, M_XA_XOR, M_XA_OR, M_XA_AND)
|
81 | 82 | def isAMOArithmetic(cmd: UInt) = cmd.isOneOf(M_XA_ADD, M_XA_MIN, M_XA_MAX, M_XA_MINU, M_XA_MAXU)
|
|
0 commit comments