From f190fec7d70c5ce032e5351f040cba380278a981 Mon Sep 17 00:00:00 2001 From: lkcl Date: Sat, 2 Oct 2021 19:38:48 +0100 Subject: [PATCH] --- 3d_gpu/architecture/dynamic_simd.mdwn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/3d_gpu/architecture/dynamic_simd.mdwn b/3d_gpu/architecture/dynamic_simd.mdwn index e88a3aa92..ac0760f1f 100644 --- a/3d_gpu/architecture/dynamic_simd.mdwn +++ b/3d_gpu/architecture/dynamic_simd.mdwn @@ -172,10 +172,15 @@ where behind the scenes the above laborious for-loops (conceptually) are created This means that nmigen needs to "understand" the partitioning, in m.If, m.Else and m.Switch, at the bare minimum. -Analysis of the internals of nmigen shows that m.If, m.Else and m.Switch are all redirected to ast.py `Switch`. Within that function Mux and other "global" functions (similar to python operator functions). The hypothesis is therefore proposed that if `Value.mux` is added in an identical way to how `operator.add` calls `__add__` this may turn out to be all that (or most of what) is needed. +Analysis of the internals of nmigen shows that m.If, m.Else, m.FSM and m.Switch are all redirected to ast.py `Switch`. Within that function Mux and other "global" functions (similar to python operator functions). The hypothesis is therefore proposed that if `Value.mux` is added in an identical way to how `operator.add` calls `__add__` this may turn out to be all that (or most of what) is needed. +A deeper analysis shows that dsl.Module uses explicit Value.cast on its +If, Elif, and Switch clauses. Overriding that and allowing a cast to +a PartitionedSignal.cast (or, PartitionedBool.cast) would be sufficient +to make Type 2 (dsl.Module) nmigen language constructs 100% abstracted from the Type 1 (ast) lower-level ones. + m.If and m.Else work by constructing a series of Switch cases, each case test being one of "--1---" or "-----1-" where the binary tests themselves are concatenated together as the "Switch" statement. With switch statements being order-dependent, the first match will succeed which will stop subsequent "Else" or "Elif" statements from being executed. For a parallel variant each partition column may be assumed to be independent. A mask of 3 bits subdivides Signals down into four separate partitions. Therefore what was previously a single-bit binary test is, just like for Partitioned Mux, actually four separate and distinct partition-column-specific single-bit binary tests. -- 2.30.2