---------------------------------------------------------------- -- ---------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; entity fakeYM3014 is port( SH : IN std_logic; MO : IN std_logic; QOUT : OUT std_logic_vector(15 downto 0); CLK : IN std_logic; RES : IN std_logic ); end fakeYM3014; architecture RTL of fakeYM3014 is component inputreg PORT ( clock : IN STD_LOGIC ; shiftin : IN STD_LOGIC ; aclr : IN STD_LOGIC ; q : OUT STD_LOGIC_VECTOR (12 DOWNTO 0) ); end component; component inbuffer PORT ( clock : IN STD_LOGIC ; aclr : IN STD_LOGIC ; data : IN STD_LOGIC_VECTOR (12 DOWNTO 0); q : OUT STD_LOGIC_VECTOR (12 DOWNTO 0) ); end component; component outbuffer PORT ( clock : IN STD_LOGIC ; aclr : IN STD_LOGIC ; data : IN STD_LOGIC_VECTOR (15 DOWNTO 0); q : OUT STD_LOGIC_VECTOR (15 DOWNTO 0) ); end component; signal sreg_to_latch : std_logic_vector(12 downto 0); signal latch_out : std_logic_vector(12 downto 0); signal to_out : std_logic_vector(15 downto 0); signal sig_OK : std_logic; begin -- external connections IN_SHIFT : inputreg port map ( CLK, MO, RES, sreg_to_latch); IN_BUF : inbuffer port map ( not SH, RES, sreg_to_latch, latch_out); sig_OK <= '0' when latch_out(12 downto 10) = "000" else '1'; OUT_BUF : outbuffer port map ( SH and sig_OK, RES, to_out, QOUT); -- 13bit to 16bit to_out(15) <= latch_out(9); to_out(14) <= latch_out(8) when latch_out(12 downto 10) = "111" else not latch_out(9); to_out(13) <= latch_out(7) when latch_out(12 downto 10) = "111" else latch_out(8) when latch_out(12 downto 10) = "110" else not latch_out(9); to_out(12) <= latch_out(6) when latch_out(12 downto 10) = "111" else latch_out(7) when latch_out(12 downto 10) = "110" else latch_out(8) when latch_out(12 downto 10) = "101" else not latch_out(9); to_out(11) <= latch_out(5) when latch_out(12 downto 10) = "111" else latch_out(6) when latch_out(12 downto 10) = "110" else latch_out(7) when latch_out(12 downto 10) = "101" else latch_out(8) when latch_out(12 downto 10) = "100" else not latch_out(9); to_out(10) <= latch_out(4) when latch_out(12 downto 10) = "111" else latch_out(5) when latch_out(12 downto 10) = "110" else latch_out(6) when latch_out(12 downto 10) = "101" else latch_out(7) when latch_out(12 downto 10) = "100" else latch_out(8) when latch_out(12 downto 10) = "011" else not latch_out(9); to_out(9) <= latch_out(3) when latch_out(12 downto 10) = "111" else latch_out(4) when latch_out(12 downto 10) = "110" else latch_out(5) when latch_out(12 downto 10) = "101" else latch_out(6) when latch_out(12 downto 10) = "100" else latch_out(7) when latch_out(12 downto 10) = "011" else latch_out(8) when latch_out(12 downto 10) = "010" else not latch_out(9); -- f e d c b a 9 8 7 6 5 4 3 2 1 0 c b a 9 8 7 6 5 4 3 2 1 0 -- 1 1 x x x x x x x x * * * * * * -> 1 1 1 1 x x x x x x x x x -- 1 0 1 x x x x x x x x * * * * * -> 1 1 0 1 x x x x x x x x x -- 1 0 0 1 x x x x x x x x * * * * -> 1 0 1 1 x x x x x x x x x -- 1 0 0 0 1 x x x x x x x x * * * -> 1 0 0 1 x x x x x x x x x -- 1 0 0 0 0 1 x x x x x x x x * * -> 0 1 1 1 x x x x x x x x x -- 1 0 0 0 0 0 1 x x x x x x x x * -> 0 1 0 1 x x x x x x x x x -- 1 0 0 0 0 0 0 x x x x x x x x x -> 0 0 1 1 x x x x x x x x x -- 0 1 1 1 1 1 1 x x x x x x x x x -> 0 0 1 0 x x x x x x x x x -- 0 1 1 1 1 1 0 x x x x x x x x * -> 0 1 0 0 x x x x x x x x x -- 0 1 1 1 1 0 x x x x x x x x * * -> 0 1 1 0 x x x x x x x x x -- 0 1 1 1 0 x x x x x x x x * * * -> 1 0 0 0 x x x x x x x x x -- 0 1 1 0 x x x x x x x x * * * * -> 1 0 1 0 x x x x x x x x x -- 0 1 0 x x x x x x x x * * * * * -> 1 1 0 0 x x x x x x x x x -- 0 0 x x x x x x x x * * * * * * -> 1 1 1 0 x x x x x x x x x to_out(8) <= latch_out(2) when latch_out(12 downto 10) = "111" else latch_out(3) when latch_out(12 downto 10) = "110" else latch_out(4) when latch_out(12 downto 10) = "101" else latch_out(5) when latch_out(12 downto 10) = "100" else latch_out(6) when latch_out(12 downto 10) = "011" else latch_out(7) when latch_out(12 downto 10) = "010" else latch_out(8) when latch_out(12 downto 10) = "001" else '0'; to_out(7) <= latch_out(1) when latch_out(12 downto 10) = "111" else latch_out(2) when latch_out(12 downto 10) = "110" else latch_out(3) when latch_out(12 downto 10) = "101" else latch_out(4) when latch_out(12 downto 10) = "100" else latch_out(5) when latch_out(12 downto 10) = "011" else latch_out(6) when latch_out(12 downto 10) = "010" else latch_out(7) when latch_out(12 downto 10) = "001" else '0'; to_out(6) <= latch_out(0) when latch_out(12 downto 10) = "111" else latch_out(1) when latch_out(12 downto 10) = "110" else latch_out(2) when latch_out(12 downto 10) = "101" else latch_out(3) when latch_out(12 downto 10) = "100" else latch_out(4) when latch_out(12 downto 10) = "011" else latch_out(5) when latch_out(12 downto 10) = "010" else latch_out(6) when latch_out(12 downto 10) = "001" else '0'; to_out(5) <= latch_out(8) when latch_out(12 downto 10) = "111" else latch_out(0) when latch_out(12 downto 10) = "110" else latch_out(1) when latch_out(12 downto 10) = "101" else latch_out(2) when latch_out(12 downto 10) = "100" else latch_out(3) when latch_out(12 downto 10) = "011" else latch_out(4) when latch_out(12 downto 10) = "010" else latch_out(5) when latch_out(12 downto 10) = "001" else '0'; to_out(4) <= latch_out(7) when latch_out(12 downto 10) = "111" else latch_out(8) when latch_out(12 downto 10) = "110" else latch_out(0) when latch_out(12 downto 10) = "101" else latch_out(1) when latch_out(12 downto 10) = "100" else latch_out(2) when latch_out(12 downto 10) = "011" else latch_out(3) when latch_out(12 downto 10) = "010" else latch_out(4) when latch_out(12 downto 10) = "001" else '0'; to_out(3) <= latch_out(6) when latch_out(12 downto 10) = "111" else latch_out(7) when latch_out(12 downto 10) = "110" else latch_out(8) when latch_out(12 downto 10) = "101" else latch_out(0) when latch_out(12 downto 10) = "100" else latch_out(1) when latch_out(12 downto 10) = "011" else latch_out(2) when latch_out(12 downto 10) = "010" else latch_out(3) when latch_out(12 downto 10) = "001" else '0'; to_out(2) <= latch_out(5) when latch_out(12 downto 10) = "111" else latch_out(6) when latch_out(12 downto 10) = "110" else latch_out(7) when latch_out(12 downto 10) = "101" else latch_out(8) when latch_out(12 downto 10) = "100" else latch_out(0) when latch_out(12 downto 10) = "011" else latch_out(1) when latch_out(12 downto 10) = "010" else latch_out(2) when latch_out(12 downto 10) = "001" else '0'; to_out(1) <= latch_out(4) when latch_out(12 downto 10) = "111" else latch_out(5) when latch_out(12 downto 10) = "110" else latch_out(6) when latch_out(12 downto 10) = "101" else latch_out(7) when latch_out(12 downto 10) = "100" else latch_out(8) when latch_out(12 downto 10) = "011" else latch_out(0) when latch_out(12 downto 10) = "010" else latch_out(1) when latch_out(12 downto 10) = "001" else '0'; to_out(0) <= latch_out(3) when latch_out(12 downto 10) = "111" else latch_out(4) when latch_out(12 downto 10) = "110" else latch_out(5) when latch_out(12 downto 10) = "101" else latch_out(6) when latch_out(12 downto 10) = "100" else latch_out(7) when latch_out(12 downto 10) = "011" else latch_out(8) when latch_out(12 downto 10) = "010" else latch_out(0) when latch_out(12 downto 10) = "001" else '0'; end RTL;