Skip to content

Commit

Permalink
Add comments to the dynamatic printer
Browse files Browse the repository at this point in the history
  • Loading branch information
ymherklotz committed Nov 6, 2024
1 parent b4b3250 commit 8e43c3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions DataflowRewriter/Component.lean
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Essentially tagger + join without internal rule
(tag ∈ oldOrder ∧ oldMap.find? tag = none) ∧
newMap = oldMap.cons tag el ∧ newOrder = oldOrder ∧ newVal = oldVal ⟩),
-- Enq a value to be tagged
(0, ⟨ T, λ (oldOrder, oldMap, oldVal) v (newOrder, newMap, newVal) =>
(1, ⟨ T, λ (oldOrder, oldMap, oldVal) v (newOrder, newMap, newVal) =>
-- Tag must be used, but no value ready, otherwise block:
newMap = oldMap ∧ newOrder = oldOrder ∧ newVal = v :: oldVal ⟩)
].toAssocList,
Expand All @@ -191,8 +191,8 @@ Essentially tagger + join without internal rule
-- Dequeue + free tag
(1, ⟨ T, λ (oldorder, oldmap, oldVal) el (neworder, newmap, newVal) =>
-- tag must be used otherwise, but no value brought, undefined behavior:
l tag , oldorder = l.cons tag ∧ oldmap.find? tag = some el ∧
newmap = oldmap.eraseAll tag ∧ neworder = l ∧ newVal = oldVal ⟩),
∃ tag , oldorder = neworder.concat tag ∧ oldmap.find? tag = some el ∧
newmap = oldmap.eraseAll tag ∧ newVal = oldVal ⟩),
].toAssocList,
internals := []
}
Expand Down
8 changes: 6 additions & 2 deletions DataflowRewriter/DynamaticPrinter.lean
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def interfaceTypes (m : AssocList String String) :=
, ("Fork6", (some "Fork", "in1:32", "out1:32 out2:32 out3:32 out4:32 out5:32 out6:32", []))
, ("TagggedFork", (none, "in1:32", "out1:32 out2:32", []))

, ("CntrlMerge", (none, "in1:32 in2:32", "out1:32 out2?:1", []))
-- TODO FIX DELAY
, ("CntrlMerge", (none, "in1:32 in2:32", "out1:32 out2?:1", [("delay", "1.234510"), ("delay2", "1.234510")]))
, ("TagggedCntrlMerge", (none, "in1:32 in2:32", "out1:32 out2?:1", []))

, ("Branch", (none, "in1:32 in2?:1", "out1+:32 out2-:32", []))
Expand All @@ -59,6 +60,9 @@ def interfaceTypes (m : AssocList String String) :=
, ("Aligner", (none, "in1:32 in2:32", "out1:32 out2:32", []))
, ("TaggerCntrlAligner", (none, "in1:32 in2:32", "out1:32 out2:32", []))

-- TODO WRONG
, ("Sink", (none, "in1:32 in2:32", "out1:32 out2:32", []))

-- Constants are currently axiomatised
, ("ConstantA", (some "Constant", "in1:0", "out1:32", [("value", m.find? "A" |>.getD "unrecognised")]))
, ("ConstantB", (some "Constant", "in1:0", "out1:32", [("value", m.find? "B" |>.getD "unrecognised")]))
Expand Down Expand Up @@ -102,7 +106,7 @@ def dynamaticString (a: ExprHigh String) (m : AssocList String String): Option S
let modules ←
a.modules.foldlM
(λ s k v => do
let fmt := (interfaceTypes m).find? v.snd |>.getD (some v.snd, "", "", [])
let fmt := (interfaceTypes m).find? v.snd |>.getD (some v.snd, "", "", [("unsupported", "true")])
return s ++ s!" {k} [type = \"{fmt.1.getD v.snd}\", label = \"{k}: {v.snd}\", in = \"{fmt.2.1}\", out = \"{fmt.2.2.1}\"{formatOptions fmt.2.2.2}];\n"
) ""
let connections :=
Expand Down
1 change: 0 additions & 1 deletion DataflowRewriter/Module.lean
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ theorem refines_product {J K} [Nonempty J] [Nonempty I] (imod₂ : Module Ident
specialize ref₂ hφ₂
all_goals sorry


theorem refines_connect {o i} :
imod ⊑ smod →
imod.connect' o i ⊑ smod.connect' o i := by sorry
Expand Down

0 comments on commit 8e43c3d

Please sign in to comment.