-- A sequential implementation of the vote-3 circuit using a -- program-like procedural description. -- (c) J. Dean Brock, 2004 library ieee ; use ieee.std_logic_1164.all ; entity VOTE3SPA is port ( Reset: in STD_LOGIC; Clock: in STD_LOGIC; SerIn: in STD_LOGIC; SerOut: out STD_LOGIC ); end VOTE3SPA ; architecture VOTE3SPA_arch_JDB of VOTE3SPA is type threecount is range 0 to 2 ; begin -- VOTE3SPA_arch_JDB process(Clock, Reset) VARIABLE CycleCount : threecount := 0 ; VARIABLE OneCount : threecount := 0 ; begin if Reset = '1' then CycleCount := 0 ; OneCount := 0 ; SerOut <= '0' ; elsif Clock'event and Clock = '1' then if CycleCount = 2 then if OneCount = 2 or (OneCount = 1 and SerIn = '1') then SerOut <= '1' ; else SerOut <= '0' ; end if ; CycleCount := 0 ; OneCount := 0 ; else SerOut <= '0' ; CycleCount := CycleCount + 1 ; if SerIn = '1' then OneCount := OneCount + 1 ; end if ; end if ; end if ; end process ; end VOTE3SPA_arch_JDB;