-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change variants and extensions to namedtuple
- Loading branch information
Showing
4 changed files
with
15 additions
and
30 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
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 |
---|---|---|
@@ -1,27 +1,13 @@ | ||
from collections import namedtuple | ||
|
||
class Variant(object): | ||
def __init__(self): | ||
self.intregs = None | ||
self.xlen = None | ||
Extensions = namedtuple("Extensions", | ||
["M", "A", "F", "D", "Q", "C"], | ||
defaults = [False] * 6) | ||
|
||
Variant = namedtuple("Variant", | ||
["intregs", "xlen", "extensions"]) | ||
|
||
class BaseRV32I(Variant): | ||
def __init__(self): | ||
super(BaseRV32I, self).__init__() | ||
self.intregs = 32 | ||
self.xlen = 32 | ||
|
||
|
||
class BaseRV32E(Variant): | ||
def __init__(self): | ||
super().__init__() | ||
self.intregs = 16 | ||
self.xlen = 32 | ||
|
||
|
||
class BaseRV64I(Variant): | ||
def __init__(self): | ||
super().__init__() | ||
self.intregs = 32 | ||
self.xlen = 64 | ||
RV32I = Variant(intregs=32, xlen=32, extensions = Extensions()) | ||
RV32E = Variant(intregs=16, xlen=32, extensions = Extensions()) | ||
RV32IC = Variant(intregs=32, xlen=32, extensions = Extensions(C=True)) | ||
|
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