<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 循環(huán)格雷碼VHDL源程序

循環(huán)格雷碼VHDL源程序

作者: 時(shí)間:2011-11-24 來(lái)源:網(wǎng)絡(luò ) 收藏

  我們知道格雷碼計數的特點(diǎn)就是相鄰的碼字只有一個(gè)比特不同,那么我們在設計格雷碼計數時(shí)找到這個(gè)比特取反就是了。找到這個(gè)比特的思路: 先將格雷碼換算成二進(jìn)制碼,此二進(jìn)制碼中從LSB到MSB第一個(gè)為''0''的比特對應的格雷碼位置即為所需位置,如果全''1''則MSB的位置為所需位置。

  下面以為例,給出一個(gè)VHDL程序。

  Library Ieee;

  Use Ieee.Std_logic_1164.All;

  Entity Demo Is Port(

  Clock :In Std_logic;

  Q : Out Std_logic_vector(3 Downto 0)); --Vector的長(cháng)度隨用戶(hù)而定,這里只是一個(gè)示例。

  End Demo;

  Architecture MyFavor Of Demo Is

  Function NxG(Argv :Std_logic_vector) Return Std_logic_vector Is --此函數完成輸入一個(gè)格雷碼返回下一個(gè)數的格雷碼

  Alias GV :Std_logic_vector(1 To Argv''Length) Is Argv;

  Variable BV,GC :Std_logic_vector(1 To Argv''Length);

  Begin

  BV(1) := GV(1);

  For I In 2 To Argv''Length Loop

  BV(I) := GV(I) Xor BV(I - 1);

  End Loop;

  GC := GV;

  For I In Argv''Length Downto 1 Loop

  If BV(I) = ''0'' Or I = 1 Then

  GC(I) := Not GC(I);

  Exit;

  End If;

  End Loop;

  Return GC;

  End NxG;

  Signal GC :Std_logic_vector(3 Downto 0);

  Begin

  Process(Clock) Begin

  If Rising_edge(Clock) Then

  GC = NxG(GC);

  End If;

  End Process;

  Q = GC;

  End MyFavor;



評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>