T
thomas_ns
Guest
Hello, everybody!
I have to transcode some project from VHDL to Verilog.
The problem is that I have some INOUT ports in VHDL code which I can't
just copy to Verilog code.
How can I do it?
example code piece:
ENTITY car IS
PORT (
RESET : IN std_logic;
CLK : IN std_logic;
AutoInit : IN std_logic;
WriteDataIn : IN std_logic_vector( 7 DOWNTO 0);
BarData : IN std_logic_vector(15 DOWNTO 0);
UpdateAddr : IN std_logic_vector(15 DOWNTO 0);
LoadAddr : IN std_logic_vector( 1 DOWNTO 0);
EndOfDma : IN std_logic;
Update : IN std_logic;
CurrentAddr : INOUT std_logic_vector(15 DOWNTO 0)
);
END car;
--**********************************************************************************************
-- Architecture Body
--**********************************************************************************************
ARCHITECTURE rtl OF car IS
BEGIN
writeadd: PROCESS ( LoadAddr, WriteDataIn, AutoInit, BarData, EndOfDma,
Update, CurrentAddr, UpdateAddr, CLK, RESET )
VARIABLE next_CurrentAddr : std_logic_vector(15 DOWNTO 0);
BEGIN
IF (AutoInit = '1') AND (EndOfDma = '1') THEN
next_CurrentAddr(7 DOWNTO 0) := BarData(7 DOWNTO 0);
ELSIF (Update = '1') THEN
next_CurrentAddr(7 DOWNTO 0) := UpdateAddr(7 DOWNTO 0);
ELSIF (LoadAddr(0) = '1') THEN
next_CurrentAddr(7 DOWNTO 0) := WriteDataIn(7 DOWNTO 0);
ELSE
next_CurrentAddr(7 DOWNTO 0) := CurrentAddr(7 DOWNTO 0);
END IF;
IF (AutoInit = '1') AND (EndOfDma = '1') THEN
next_CurrentAddr(15 DOWNTO 8) := BarData(15 DOWNTO 8);
ELSIF (Update = '1') THEN
next_CurrentAddr(15 DOWNTO 8) := UpdateAddr(15 DOWNTO 8);
ELSIF (LoadAddr(1) = '1') THEN
next_CurrentAddr(15 DOWNTO 8) := WriteDataIn(7 DOWNTO 0);
ELSE
next_CurrentAddr(15 DOWNTO 8) := CurrentAddr(15 DOWNTO 8);
END IF;
IF ( RESET = '1' ) THEN -- Asynchronous clear
CurrentAddr(15 DOWNTO 0) <= "0000000000000000";
ELSIF (CLK'EVENT AND (CLK = '0')) THEN
CurrentAddr(15 DOWNTO 0) <= next_CurrentAddr(15 DOWNTO 0);
END IF;
END PROCESS;
END rtl;
Kind regards
thomas_ns
--
Message posted using http://www.talkaboutprogramming.com/group/comp.lang.vhdl/
More information at http://www.talkaboutprogramming.com/faq.html
I have to transcode some project from VHDL to Verilog.
The problem is that I have some INOUT ports in VHDL code which I can't
just copy to Verilog code.
How can I do it?
example code piece:
ENTITY car IS
PORT (
RESET : IN std_logic;
CLK : IN std_logic;
AutoInit : IN std_logic;
WriteDataIn : IN std_logic_vector( 7 DOWNTO 0);
BarData : IN std_logic_vector(15 DOWNTO 0);
UpdateAddr : IN std_logic_vector(15 DOWNTO 0);
LoadAddr : IN std_logic_vector( 1 DOWNTO 0);
EndOfDma : IN std_logic;
Update : IN std_logic;
CurrentAddr : INOUT std_logic_vector(15 DOWNTO 0)
);
END car;
--**********************************************************************************************
-- Architecture Body
--**********************************************************************************************
ARCHITECTURE rtl OF car IS
BEGIN
writeadd: PROCESS ( LoadAddr, WriteDataIn, AutoInit, BarData, EndOfDma,
Update, CurrentAddr, UpdateAddr, CLK, RESET )
VARIABLE next_CurrentAddr : std_logic_vector(15 DOWNTO 0);
BEGIN
IF (AutoInit = '1') AND (EndOfDma = '1') THEN
next_CurrentAddr(7 DOWNTO 0) := BarData(7 DOWNTO 0);
ELSIF (Update = '1') THEN
next_CurrentAddr(7 DOWNTO 0) := UpdateAddr(7 DOWNTO 0);
ELSIF (LoadAddr(0) = '1') THEN
next_CurrentAddr(7 DOWNTO 0) := WriteDataIn(7 DOWNTO 0);
ELSE
next_CurrentAddr(7 DOWNTO 0) := CurrentAddr(7 DOWNTO 0);
END IF;
IF (AutoInit = '1') AND (EndOfDma = '1') THEN
next_CurrentAddr(15 DOWNTO 8) := BarData(15 DOWNTO 8);
ELSIF (Update = '1') THEN
next_CurrentAddr(15 DOWNTO 8) := UpdateAddr(15 DOWNTO 8);
ELSIF (LoadAddr(1) = '1') THEN
next_CurrentAddr(15 DOWNTO 8) := WriteDataIn(7 DOWNTO 0);
ELSE
next_CurrentAddr(15 DOWNTO 8) := CurrentAddr(15 DOWNTO 8);
END IF;
IF ( RESET = '1' ) THEN -- Asynchronous clear
CurrentAddr(15 DOWNTO 0) <= "0000000000000000";
ELSIF (CLK'EVENT AND (CLK = '0')) THEN
CurrentAddr(15 DOWNTO 0) <= next_CurrentAddr(15 DOWNTO 0);
END IF;
END PROCESS;
END rtl;
Kind regards
thomas_ns
--
Message posted using http://www.talkaboutprogramming.com/group/comp.lang.vhdl/
More information at http://www.talkaboutprogramming.com/faq.html