1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00
myhdl/example/manual/gray_inc.py
2016-06-20 18:59:39 +02:00

16 lines
327 B
Python

from myhdl import block, Signal, modbv
from bin2gray import bin2gray
from inc import inc
@block
def gray_inc(graycnt, enable, clock, reset, width):
bincnt = Signal(modbv(0)[width:])
inc_0 = inc(bincnt, enable, clock, reset)
bin2gray_0 = bin2gray(B=bincnt, G=graycnt)
return inc_0, bin2gray_0