forked from yellekelyk/scrape-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpecL1Cache.py
31 lines (25 loc) · 878 Bytes
/
SpecL1Cache.py
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
31
import pdb
import re
from SpecCache import *
class SpecL1Cache(SpecCache):
"A class to aid in parsing spec caches, which can be in a number of forms"
def __init__(self, string):
self.__sizeI = "NA"
self.__sizeD = "NA"
# remove all parentheses before parsing
string = string.replace('(','')
string = string.replace(')','')
SpecCache.__init__(self, string)
for match in self.matches():
size = int(match[0]) * self.toKB(match[1])
if match[2] == "i":
self.__sizeI = size
elif match[2] == "d":
self.__sizeD = size
else:
# we assume it's i+d
raise Exception("Unexpected L1Cache string: " + string)
def L1I(self):
return self.__sizeI
def L1D(self):
return self.__sizeD