正在加载图片...
对比2: Unused states Treatment 对此2: Unused States Treatment uNused States Treatment oOutput-Coded State Assignment ●状态图有6个状态 ●限制:机器不小心进入“未用状态”,可以自动回 ●实际5个触发器有32个状态,未用状态作为“无关 到正常”状态 ●自由度:通过引入“无关项”,允许对逻辑电路作 Karnaugh Map化筒只能处理莓单问题“……艹 计算机化简:许多综合软件易处理大舰模 一定的简化— Minimal cost apporach 计但却无活处理无近 般需要设计者单独写一段处理代码:; :: 对比2; Unused States Treatment VHDL for the Guessing game Machine OOutput-Coded State Assignment Use IEEE std_logic_1164.all, Port( Clock, Reset, G1, G2, G3. G4 L1,L2,L3,L4,E Out STD Logic): Type Sreg_type is(ST, S2, S3, S4, SOK, SERR) ●输出简化,例如ERR=4(G+G+G2) 可以证明,最简或与+l2L1G4+G3+G) 1 when S L2 <=1 when Sreg 式”只需5项,较与或+L2·L:L-(G4+ 式"需16项来得简单+L4D2LG+G2+G) RR<="1 +LL,.I2-Lr-ERR-(G+G,G,+G) VHDL for the Guessing Game Machine Guessing Game If CLOCK'event and CLoCK=1 then SET-1 then Sreg <a SOK; else ●Noti when si> If G2=1 or G3*" or G4*1 then Sreg s SERR The original quessing game is easy to win after s2s If GrrorG3 minute of practice because the lamps cycle at a very consistent rate of 4Hz when S3=> If G1=1or G4=t' then triple the clock speed but allow the lamps to stay when sas>f Gier or G2etr' or G3=r then sg in each state for a random length of time The user truly must guess whether a given lamp when SOK I SERR = If G1=0 an will stay on long enough for the corresponding pushbutton to be pressed when others => Sreg <s S1 Add an enable input, which is driven by the End case: S,Huca a Linear Feedback Shift Register(LFSR) End vggame_ arch4 24 ‹Unused States Treatment z状态图有6个状态 z实际5个触发器有32个状态,未用状态作为“无关 状态” zKarnaugh Map化简:只能处理简单问题 z计算机化简:许多综合软件容易处理大规模设 计,但却无法处理 “无关项”; 一般需要设计者单独写一段处理代码 对比2:Unused States Treatment Unused States Treatment 25 ‹Output-Coded State Assignment z限制:机器不小心进入“未用状态”,可以自动回 到“正常”状态 z自由度:通过引入“无关项”,允许对逻辑电路作 一定的简化——Minimal cost apporach 对比2:Unused States Treatment Unused States Treatment 26 ‹Output-Coded State Assignment z输出简化, 例如 可以证明,最简“或与 式”只需5项,较“与或 式”需16项来得简单 1 14 3 2 1 2 4 31 2 1 3 421 321 4 321 4321 4321 ( ) ( ) ( ) ( ) ( ) n ERR L G G G LL G G G LLL G G G LLLL G G G L L L L ERR G G G G + =⋅ + + +⋅⋅ + + +⋅ ⋅ ⋅ + + +⋅ ⋅ ⋅⋅ + + +⋅⋅⋅⋅ ⋅ + + + 对比2:Unused States Treatment Unused States Treatment 27 VHDL for the Guessing Game Machine Library IEEE; Use IEEE.std_logic_1164.all; Entity Vggame is Port ( Clock, Reset, G1, G2, G3, G4 : in STD_LOGIC; L1, L2, L3, L4, Err : out STD_LOGIC ); End; Architecture Vggame_arch of Vggame is Type Sreg_type is (S1, S2, S3, S4, SOK, SERR); signal Sreg: Sreg_type; Begin L1 <= '1' when Sreg = S1 else '0'; L2 <= '1' when Sreg = S2 else '0'; L3 <= '1' when Sreg = S3 else '0'; L4 <= '1' when Sreg = S4 else '0'; ERR <= '1' when Sreg = SERR else '0'; Process (CLOCK) Begin 28 If CLOCK'event and CLOCK = '1' then If RESET = '1' then Sreg <= SOK; else case Sreg is when S1 => If G2='1' or G3='1' or G4='1' then Sreg <= SERR; elsif G1='1' then Sreg <= SOK; else Sreg <= S2; End if; when S2 => If G1='1' or G3='1' or G4='1' then Sreg <= SERR; elsif G1='1' then Sreg <= SOK; else Sreg <= S3; End if; when S3 => If G1='1' or G2='1' or G4='1' then Sreg <= SERR; elsif G1='1' then Sreg <= SOK; else Sreg <= S4; End if; when S4 => If G1='1' or G2='1' or G3='1' then Sreg <= SERR; elsif G1='1' then Sreg <= SOK; else Sreg <= S1; End if; when SOK | SERR => If G1='0' and G2='0' and G3='0' and G4='0' then Sreg <= S1; End if; when others => Sreg <= S1; End case; End If; End If; End process; End Vggame_arch; SErr S1 S2 S3 S4 G1 ’ .G2’.G3’.G4’ G1+G3+G4 G1+G2+G4 G1+G2+G3 G2+G3+G4 G1 ’ .G2’.G3’.G4’ G1 ’ .G2’.G3’.G4’ G1 ’ .G2’.G3’.G4’ G1 ’ .G2’.G3’.G4’ SOK G1 ’ .G2.G3’.G4’ G1 ’ .G2’.G3.G4’ G1 ’ .G2’.G3’.G4 G1.G2’.G3’.G4’ G1+G2+ G3+G4 G1 ’ .G2’.G3’.G4’ SErr S1 S2 S3 S4 G1 ’ .G2’.G3’.G4’ G1+G3+G4 G1+G2+G4 G1+G2+G3 G2+G3+G4 G1 ’ .G2’.G3’.G4’ G1 ’ .G2’.G3’.G4’ G1 ’ .G2’.G3’.G4’ G1 ’ .G2’.G3’.G4’ SOK G1 ’ .G2.G3’.G4’ G1 ’ .G2’.G3.G4’ G1 ’ .G2’.G3’.G4 G1.G2’.G3’.G4’ G1+G2+ G3+G4 G1 ’ .G2’.G3’.G4’ VHDL for the Guessing Game Machine 29 Guessing Game ‹Noting zThe original guessing game is easy to win after a minute of practice because the lamps cycle at a very consistent rate of 4Hz zTo make it more challenging, we can double or triple the clock speed but allow the lamps to stay in each state for a random length of time zThe user truly must guess whether a given lamp will stay on long enough for the corresponding pushbutton to be pressed zAdd an enable input, which is driven by the output of a pseudorandom sequence generator, a Linear Feedback Shift Register (LFSR)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有