X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fsoc%2Fexperiment%2Ficache.py;h=ff45332d8fd9a5460464468fcefbffd9e808306f;hb=c703e816770b6083cce8f3ddf8d757d211b775f4;hp=b0b674c845601d369d379e880f199ef563df4263;hpb=41ef74f3856b78158448d06d4ffc56623a09a2bb;p=soc.git diff --git a/src/soc/experiment/icache.py b/src/soc/experiment/icache.py index b0b674c8..ff45332d 100644 --- a/src/soc/experiment/icache.py +++ b/src/soc/experiment/icache.py @@ -335,22 +335,33 @@ class ICache(FetchUnitInterface, Elaboratable, ICacheConfig): # use FetchUnitInterface, helps keep some unit tests running self.use_fetch_iface = False - # test if microwatt compatibility is to be enabled + # test if small cache to be enabled + self.small_cache = (hasattr(pspec, "small_cache") and + (pspec.small_cache == True)) + # test if microwatt compatibility to be enabled self.microwatt_compat = (hasattr(pspec, "microwatt_compat") and (pspec.microwatt_compat == True)) XLEN = pspec.XLEN - + LINE_SIZE = 64 + TLB_SIZE = 16 + NUM_LINES = 16 + NUM_WAYS = 2 + if self.small_cache: + # reduce way sizes and num lines to ridiculously small + NUM_LINES = 2 + NUM_WAYS = 1 + TLB_SIZE = 2 if self.microwatt_compat: - # reduce way sizes and num lines - ICacheConfig.__init__(self, LINE_SIZE=XLEN, - XLEN=XLEN, - NUM_LINES = 2, - NUM_WAYS = 1, - TLB_SIZE=2 # needs device-tree update - ) - else: - ICacheConfig.__init__(self, LINE_SIZE=XLEN, XLEN=XLEN) + # reduce way sizes + NUM_WAYS = 1 + + ICacheConfig.__init__(self, LINE_SIZE=LINE_SIZE, + XLEN=XLEN, + NUM_LINES = NUM_LINES, + NUM_WAYS = NUM_WAYS, + TLB_SIZE=TLB_SIZE + ) def use_fetch_interface(self): self.use_fetch_iface = True