1 from enum
import Enum
, unique
8 file_dir
= os
.path
.dirname(os
.path
.realpath(__file__
))
9 file_path
= os
.path
.join(file_dir
, name
)
10 if not os
.path
.isfile(file_path
):
11 url
= 'https://libre-riscv.org/openpower/isatables/' + name
12 r
= requests
.get(url
, allow_redirects
=True)
13 with
open(file_path
, 'w') as outfile
:
14 outfile
.write(r
.content
.decode("utf-8"))
15 with
open(file_path
, 'r') as csvfile
:
16 reader
= csv
.DictReader(csvfile
)
20 # names of the fields in the tables that don't correspond to an enum
21 single_bit_flags
= ['CR in', 'CR out', 'inv A', 'inv out',
22 'cry out', 'BR', 'sgn ext', 'upd', 'rsrv', '32b',
23 'sgn', 'lk', 'sgl pipe']
25 # default values for fields in the table
26 default_values
= {'unit': "NONE", 'internal op': "OP_ILLEGAL",
27 'in1': "RA", 'in2': 'NONE', 'in3': 'NONE', 'out': 'NONE',
29 'rc' : 'NONE', 'cry in' : 'ZERO', 'form': 'NONE'}
31 def get_signal_name(name
):
34 return name
.lower().replace(' ', '_')
79 class InternalOp(Enum
):