나는 두 개의 코드를 가지고 있는데 하나는 Verilog에 있고 다른 하나는 16 비트 2 진수에있는 코드의 수를 세는 vhdl에있다. 둘 다 똑같은 일을하지만 자일링스 ISE를 사용하여 합성 한 후에는 다른 합성 보고서를 얻는다.VHDL과 Verilog에서 같은 디자인. 그러나 속도와 자원의 용도가 다릅니 까?
Verilog 코드 :
module num_ones_for(
input [15:0] A,
output reg [4:0] ones
);
integer i;
[email protected](A)
begin
ones = 0; //initialize count variable.
for(i=0;i<16;i=i+1) //for all the bits.
ones = ones + A[i]; //Add the bit to the count.
end
endmodule
VHDL 코드 :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity num_ones_for is
Port (A : in STD_LOGIC_VECTOR (15 downto 0);
ones : out STD_LOGIC_VECTOR (4 downto 0));
end num_ones_for;
architecture Behavioral of num_ones_for is
begin
process(A)
variable count : unsigned(4 downto 0) := "00000";
begin
count := "00000"; --initialize count variable.
for i in 0 to 15 loop --for all the bits.
count := count + ("0000" & A(i)); --Add the bit to the count.
end loop;
ones <= std_logic_vector(count); --assign the count to output.
end process;
end Behavioral;
LUT의 VHDL과의 Verilog에 사용되는 수 - (25) 및 회로 (20) 조합 지연 - 3.330 NS 2.597 ns.
당신이 볼 수 있듯이 Verilog 코드는 훨씬 더 효율적으로 보입니다. 왜 그런가요?
내가 볼 수있는 유일한 차이점은 VHDL 코드에서 MSB쪽에 4 개의 0이 추가되는 방법입니다. 하지만 그렇지 않으면 VHDL이 오류를 발생시키기 때문에이 작업을 수행했습니다.
내가 사용하고있는 도구 또는 HDL 언어 또는 코드 작성 방법 때문에 이것이 발생 했습니까?
문제는 언어가 아닙니다. 이 도구는 각 언어 프런트 엔드에 대해 서로 다른 옵티 마이저를 사용합니다. 최적은 약 13 개의 LUT이어야합니다. – Paebbels
@Paebbels LUT의 크기에 따라 달라집니다 ... – JHBonarius
@JHBonarius 예,하지만 그는 LUT6 대신 LUT4를 사용하는 오래된 자일링스 디바이스를 사용하지 않는다고 가정합니다. – Paebbels