아래 코드는 자일링스 애플리케이션 노트에서 Verilog의 델타 - 시그마 DAC를 구현하고 이에 상응하는 VHDL 코드를 작성하려고합니다. 나는 Verilog에 대해 아무것도 모른다. 그리고 초보자 인 VHDL에서 많은 추측을하고 아마 초심자 오류 (아래 코드)를 만들어야했다. 누군가가 도와 주시면 번역이 정확한지 확신 할 수 없습니까?Verilog에서 VHDL 로의 델타 - 시그마 DAC
원래의 Verilog VHDL에서
`timescale 100 ps/10 ps
`define MSBI 7
module dac(DACout, DACin, Clk, Reset);
output DACout;
reg DACout;
input [`MSBI:0] DACin;
input Clk;
input Reset;
reg [`MSBI+2:0] DeltaAdder;
reg [`MSBI+2:0] SigmaAdder;
reg [`MSBI+2:0] SigmaLatch;
reg [`MSBI+2:0] DeltaB;
always @(SigmaLatch) DeltaB = {SigmaLatch[`MSBI+2], SigmaLatch[`MSBI+2]} << (`MSBI+1);
always @(DACin or DeltaB) DeltaAdder = DACin + DeltaB;
always @(DeltaAdder or SigmaLatch) SigmaAdder = DeltaAdder + SigmaLatch;
always @(posedge Clk or posedge Reset)
begin
if(Reset)
begin
SigmaLatch <= #1 1'bl << (`MSBI+1);
DACout <= #1 1'b0;
end
else
begin
SigmaLatch <== #1 SigmaAdder;
DACout <= #1 SigmaLatch[`MSBI+2];
end
end
endmodule
내 시도 : 당신이 ieee.std_logic_unsigned (또는 _arith) 또는 둘 모두를 사용하는 것처럼
entity audio is
generic(
width : integer := 8
);
port(
reset : in std_logic;
clock : in std_logic;
dacin : in std_logic_vector(width-1 downto 0);
dacout : out std_logic
);
end entity;
architecture behavioral of audio is
signal deltaadder : std_logic_vector(width+2 downto 0);
signal sigmaadder : std_logic_vector(width+2 downto 0);
signal sigmalatch : std_logic_vector(width+2 downto 0);
signal deltafeedback : std_logic_vector(width+2 downto 0);
begin
deltafeedback <= (sigmalatch(width+2), sigmalatch(width+2), others => '0');
deltaadder <= dacin + deltafeedback;
sigmaadder <= deltaadder + sigmalatch;
process(clock, reset)
begin
if (reset = '1') then
sigmalatch <= ('1', others => '0');
dacout <= '0';
elsif rising_edge(clock) then
sigmalatch <= sigmaadder;
dacout <= sigmalatch(width+2);
end if;
end process;
end architecture;
Verilog 및 VHDL 시뮬레이션을 시도하고 출력을 확인 했습니까? –
동등성 검사 도구는 Verilog 코드가 VHDL 코드와 기능적으로 동일한 지 확인할 수 있습니다. Verilog는'# 1 '지연을 없애고 합성 할 수있는 것처럼 보입니다. – toolic