Altera_Forum
Honored Contributor
14 years agoWhich one is the right design??(very simple design)
please i need yours help.
in the following design the result was calculated by the signal (x) and connected to the output port (output),
i got the following result:
lut =17 worst-case tsu = 4.8ns
worst-case tco = 8.5
worst-case th = -1.1ns library ieee; use ieee.std_logic_1164.all; entity test is port( clk : in std_logic; rst : in std_logic; input : in std_logic_vector (7 downto 0); output : out std_logic_vector (7 downto 0)); end entity test; architecture kkk of test is signal x : std_logic_vector (7 downto 0); signal q : std_logic_vector (7 downto 0); begin q <= input; process (clk,rst) begin if (rst='1') then x <= "00000000"; elsif (clk'event and clk='1') then x(0) <= q(7) AND q(6) AND q(4) AND q(3) AND q(1) AND q(0) ; x(1) <= q(4) AND q(2) ; x(2) <= q(5) AND q(0) ; x(3) <= q(4) AND q(2) ; x(4) <= q(7) AND q(5) ; x(5) <= q(7) AND q(5) AND q(4) AND q(1) ; x(6) <= q(5) AND q(3) AND q(0) ; x(7) <= q(5) AND q(3) AND q(1) AND q(0) ; output <= x ; end if; end process; end architecture kkk; while in the following design i used the output port directly. i got:
lut =9 worst-case tsu = 5 ns
worst-case tco = 8.8 ns
worst-case th = -0.7 ns library ieee; use ieee.std_logic_1164.all; entity test is port( clk : in std_logic; rst : in std_logic; input : in std_logic_vector (7 downto 0); output : out std_logic_vector (7 downto 0)); end entity test; architecture kkk of test is signal q : std_logic_vector (7 downto 0); begin q <= input; process (clk,rst) begin if (rst='1') then output <= "00000000"; elsif (clk'event and clk='1') then output(0) <= q(7) AND q(6) AND q(4) AND q(3) AND q(1) AND q(0) ; output(1) <= q(4) AND q(2) ; output(2) <= q(5) AND q(0) ; output(3) <= q(4) AND q(2) ; output(4) <= q(7) AND q(5) ; output(5) <= q(7) AND q(5) AND q(4) AND q(1) ; output(6) <= q(5) AND q(3) AND q(0) ; output(7) <= q(5) AND q(3) AND q(1) AND q(0) ; end if; end process; end architecture kkk;
thanks in advance