Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hammer FPGA backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kia
Hammer FPGA backend
Commits
58fe2311
Commit
58fe2311
authored
3 years ago
by
Kia
Browse files
Options
Downloads
Patches
Plain Diff
this is the best way to do a synthesizable cutting-off of the top K bits, i believe.
parent
bb6141f3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rtl_lib/shift_testing.py
+30
-0
30 additions, 0 deletions
rtl_lib/shift_testing.py
with
30 additions
and
0 deletions
rtl_lib/shift_testing.py
0 → 100644
+
30
−
0
View file @
58fe2311
from
enum
import
Enum
from
nmigen
import
*
from
nmigen.hdl.rec
import
*
from
nmigen.asserts
import
*
from
nmigen.cli
import
main
class
DummyPlug
(
Elaboratable
):
#def __init__(self):
def
elaborate
(
self
,
platform
):
m
=
Module
()
egg
=
Signal
(
8
,
reset
=
219
)
foo
=
Signal
(
8
)
# the "constant mask" idea lets us use a constant compile-time bitmask while still letting us lop off a variable number of bits
counter
=
Signal
(
8
)
m
.
d
.
sync
+=
counter
.
eq
(
counter
+
1
)
m
.
d
.
sync
+=
foo
.
eq
(((
egg
<<
counter
)
&
0xff
)
>>
counter
)
return
m
if
__name__
==
'
__main__
'
:
baka
=
DummyPlug
()
main
(
baka
)
#platform.build(DummyPlug())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment