From: Luke Kenneth Casson Leighton Date: Tue, 9 Nov 2021 12:49:54 +0000 (+0000) Subject: core.py: create a dictionary of lists of Function Units capable of X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=253393ef3c00086098fbd319f9e4e3c19ac7667b;p=soc.git core.py: create a dictionary of lists of Function Units capable of dealing with a particular instruction (by power_enums Function: ALU, MMU, DIV LOGICAL etc.) --- diff --git a/src/soc/simple/core.py b/src/soc/simple/core.py index 936dbfe2..8b4c9c43 100644 --- a/src/soc/simple/core.py +++ b/src/soc/simple/core.py @@ -39,9 +39,10 @@ from openpower.decoder.power_decoder2 import get_rdflags from openpower.decoder.decode2execute1 import Data from soc.experiment.l0_cache import TstL0CacheBuffer # test only from soc.config.test.test_loadstore import TestMemPspec -from openpower.decoder.power_enums import MicrOp +from openpower.decoder.power_enums import MicrOp, Function from soc.config.state import CoreState +from collections import defaultdict import operator from nmutil.util import rising_edge @@ -289,6 +290,20 @@ class NonProductionCore(ControlBase): for i, funame in enumerate(fus.keys()): fu_bitdict[funame] = fu_enable[i] + # identify function units and create a list by fnunit so that + # PriorityPickers can be created for selecting one of them that + # isn't busy at the time the incoming instruction needs passing on + by_fnunit = defaultdict(list) + for fname, member in Function.__members__.items(): + for funame, fu in fus.items(): + fnunit = fu.fnunit.value + if member.value & fnunit: # this FU handles this type of op + by_fnunit[fname].append(fu) # add FU to list, by FU name + + # ok now just print out the FUs because we can + for fname, fu_list in by_fnunit.items(): + print ("FUs by type", fname, fu_list) + # enable the required Function Unit based on the opcode decode # note: this *only* works correctly for simple core when one and # *only* one FU is allocated per instruction. what is actually