【Verilog】Gray Code Counter 格雷码计数器

Gray  code counters (having one bit change per counter transition) are often used in FIFO design and digital communication.

Here I will show two styles gray code counter.

Style #1

First style gray code counter uses a single set of flip-flops as the Gray code register with accompanying Gray-tobinary conversion, binary increment, and binary-to-Gray conversion. 

 

 

 1 module  gray_counter(
 2          input  iclk,
 3          input  irst_n,
 4          input  ivalid,
 5          output   reg  [ 3 : 0 ] gray);
 6
 7 wire  [ 3 : 0 ] bin_counter;
 8 wire  [ 3 : 0 ] gray_counter;
 9  
10 reg   [ 3 : 0 ] G2B_counter;
11
12 //  convert gray to  bin;
13 always @(ocounter)
14 begin
15     G2B_counter[
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值