-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from DFiantHDL/i116
Fix #116
- Loading branch information
Showing
4 changed files
with
85 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package issues | ||
|
||
import munit.* | ||
import dfhdl.* | ||
|
||
class IssuesSpec extends FunSuite: | ||
test("i116 compiles with no exception"): | ||
i116.GlobCounter(64).compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// format: off | ||
package issues.i116 | ||
|
||
import dfhdl.* | ||
|
||
case class Test ( | ||
a : Bit <> VAL, | ||
b : Bit <> VAL | ||
) extends Struct | ||
|
||
class GlobCounter (val width: Int <> CONST) extends RTDesign: | ||
val req = Bit <> IN | ||
val req2 = Bit <> IN | ||
val t = Test <> IN | ||
val t_b = Bit <> VAR | ||
t_b := t.b | ||
val t_int = Test <> VAR | ||
t_int := t | ||
|
||
val cnt = UInt(width) <> OUT.REG init 0 | ||
|
||
if (t.a) { | ||
if (t.b) { | ||
cnt.din := cnt + 1 | ||
} | ||
} | ||
|
||
if (req) { | ||
if (t.b) { | ||
cnt.din := cnt + 1 | ||
} | ||
} | ||
|
||
if (t.a && t.b) { | ||
cnt.din := cnt + 1 | ||
} | ||
|
||
if (t.a) { | ||
if (t_b) { | ||
cnt.din := cnt + 1 | ||
} | ||
} | ||
|
||
if (t_int.a) { | ||
if (t_int.b) { | ||
cnt.din := cnt + 1 | ||
} | ||
} | ||
|
||
if (req) { | ||
if (req2) { | ||
cnt.din := cnt + 1 | ||
} | ||
} | ||
end GlobCounter |