-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5651c50
commit 5c8fe79
Showing
7 changed files
with
113 additions
and
162 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,11 @@ | ||
from myhdl import block | ||
|
||
@block | ||
def bin2gray(B, G): | ||
# DUMMY PLACEHOLDER | ||
""" Gray encoder. | ||
B -- binary input | ||
G -- Gray encoded output | ||
""" | ||
pass |
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,16 @@ | ||
from myhdl import block, always_comb | ||
|
||
@block | ||
def bin2gray(B, G): | ||
# INCORRECT IMPLEMENTATION | ||
""" Gray encoder. | ||
B -- binary input | ||
G -- Gray encoded output | ||
""" | ||
|
||
@always_comb | ||
def logic(): | ||
G.next = B[0] | ||
|
||
return logic |
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,6 @@ | ||
def nextLn(Ln): | ||
""" Return Gray code Ln+1, given Ln. """ | ||
Ln0 = ['0' + codeword for codeword in Ln] | ||
Ln1 = ['1' + codeword for codeword in Ln] | ||
Ln1.reverse() | ||
return Ln0 + Ln1 |
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 |
---|---|---|
|
@@ -54,4 +54,4 @@ def runTests(self, test): | |
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
unittest.main(verbosity=2) |