forked from chipsalliance/firrtl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for clocks. Added remove scope and special chars passes. …
…Added tests. Made more tests pass
- Loading branch information
Showing
56 changed files
with
696 additions
and
338 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
========= RENAME STRATEGY ========= | ||
Special chars ~!@#$%^*-_+=?/ get renamed to _XX, where XX is a hex representation of the symbol | ||
|
||
a_x | ||
=> | ||
a_XXx | ||
|
||
a_XXx | ||
=> | ||
a_XXXXx | ||
|
||
This guarantees all symbols use a subset of the character set | ||
|
||
Now, I need to rename duplicate symbols, so: | ||
|
||
wire x | ||
when p | ||
wire x | ||
|
||
=> | ||
|
||
wire x%0 | ||
when p | ||
wire x%1 | ||
|
||
We know that all new symbols are unique because they use a special character | ||
At this point, all names are unique. | ||
|
||
-- Bundle Expansion -- | ||
To deal with bundle expansion, use another different special character: | ||
|
||
wire x : {a,b} | ||
|
||
=> | ||
|
||
wire x#a | ||
wire x#b | ||
|
||
-- Vector Expansion -- | ||
|
||
To deal with bundle expansion, use another different special character: | ||
|
||
wire x : UInt<1>[3] | ||
|
||
=> | ||
|
||
wire x$0 : UInt<1> | ||
wire x$1 : UInt<1> | ||
wire x$2 : UInt<1> | ||
|
||
-- Creating Temporaries -- | ||
To deal with creating temporaries, use another different special character: | ||
|
||
node x = a + b * c | ||
=> | ||
node x!0 = b * c | ||
node x!1 = a + x!0 | ||
node x = x!1 | ||
|
||
Finally, to deal with backends that only use subsets of the special characters, do another rename step to remove special characters (must remove $ again!) | ||
|
||
ASCII Hex | ||
_ 5F __ | ||
~ 7E _A | ||
! 21 _B | ||
@ 40 _C | ||
# 23 _D | ||
$ 24 _E | ||
% 25 _F | ||
^ 5E _G | ||
* 2A _H | ||
- 2D _I | ||
+ 2B _J | ||
= 3D _K | ||
? 3F _L | ||
/ 2F _M | ||
|
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
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
Oops, something went wrong.