kaiser
Newbie level 5
Some one help me with this code in VHDL .....i want to cnvert this code in a verilog code and i dont know how....HEELLLPPP
This is the code in VHDL:
AND HERE IS WHAT I MAKE AND DONT WORK...
This is the code in VHDL:
Code:
entity vhdlmodule is
Port ( CLKIN : in std_logic;
AN3 : inout std_logic;
AN2 : inout std_logic;
AN1 : inout std_logic;
AN0 : inout std_logic;
LED : out std_logic_vector(6 downto 0));
end vhdlmodule;
architecture Behavioral of vhdlmodule is
signal CTR : STD_LOGIC_VECTOR(12 downto 0);
begin
Process (CLKIN)
begin
if CLKIN'event and CLKIN = '1' then
if (CTR="0000000000000") then
if (AN0='0') then
AN0 <= '1';
LED <= "0101011";
AN1 <= '0';
elsif (AN1='0') then
AN1 <= '1';
LED <= "0101011";
AN2 <= '0';
elsif (AN2='0') then
AN2 <= '1';
LED <= "0001000";
AN3 <= '0';
elsif (AN3='0') then
AN3 <= '1';
LED <= "0000110";
AN0 <= '0';
end if;
end if;
CTR<=CTR+"0000000000001";
if (CTR > "1000000000000") then
CTR<="0000000000000";
end if;
end if; -- CLK'event and CLK = '1'
End Process;
End Behavioral
AND HERE IS WHAT I MAKE AND DONT WORK...
Code:
module pace( CLK,
AN0,
AN1,
AN2,
AN3,
LED
);
inout AN0,AN1,AN2,AN3;
input CLK;
output [6:0] LED;
reg [6:0] LED;
reg [12:0] count;
always @ (posedge CLK)
if (count==13'h0)
begin
if (!AN0) begin
AN0 <= 1'b1;
LED <= 7'b0010010; // A
AN1 <= 1'b0;
end
else if (!AN1) begin
AN1 <= 1'b1;
LED <= 7'b0110001; // C
AN2 <= 1'b0;
end
else if (!AN2) begin
AN2 <= 1'b1;
LED <= 7'b0011000; // P
AN3 <= 1'b0;
end
else if (!AN3) begin
AN3 <= 1'b1;
LED <= 7'b0110000; // E
AN0 <= 0;
end
count <= count + 13'b1;
if (count > 13'h1000) begin
count <= 13'h0;
end
end
endmodule