From: Luke Kenneth Casson Leighton Date: Mon, 8 Apr 2019 03:07:00 +0000 (+0100) Subject: use constants with semi-useful names X-Git-Tag: div_pipeline~2273 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13f3c2fadfaf6f397095331d37147cd1b68928ed;p=soc.git use constants with semi-useful names --- diff --git a/TLB/src/SetAssociativeCache.py b/TLB/src/SetAssociativeCache.py index a32cf785..7569d984 100644 --- a/TLB/src/SetAssociativeCache.py +++ b/TLB/src/SetAssociativeCache.py @@ -3,6 +3,11 @@ from nmigen.cli import main from AddressEncoder import AddressEncoder +SA_NA = "00" # no action (none) +SA_RD = "01" # read +SA_WR = "10" # write + + class SetAssociativeCache(): """ Set Associative Cache Memory @@ -32,7 +37,7 @@ class SetAssociativeCache(): # Input self.enable = Signal(1) - self.command = Signal(2) # 00=None, 01=Read, 10=Write + self.command = Signal(2) # 00=None, 01=Read, 10=Write (see SA_XX) self.set = Signal(max=set_count) self.tag = Signal(tag_size) self.data_i = Signal(data_size + tag_size) @@ -50,7 +55,7 @@ class SetAssociativeCache(): with m.If(self.enable): with m.Switch(self.command): # Search all sets at a particular tag - with m.Case("01"): + with m.Case(SA_RD): # Vector to store valid results valid_vector = [] # Loop through memory setting what set to read @@ -103,9 +108,9 @@ class SetAssociativeCache(): ] # TODO # Write to a given tag - # with m.Case("10"): + # with m.Case(SA_WR): # Search for available space # What to do when there is no space # Maybe catch multiple tags write here? # TODO - return m \ No newline at end of file + return m