Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

state machine problem in VHDL..

Status
Not open for further replies.
cnt >4096 hwo that would be possible?
 

uhm.....try chaging it..and run it..
i think it willnot work
 

hi leoren_tm
i think the clock devide part should be writen in this way:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY main IS
PORT(
input_old : in std_logic_vector( 1 downto 0);
clk, pb : in std_logic;
output : OUT STD_LOGIC_VECTOR(10 downto 0));
END main;

ARCHITECTURE struct OF main IS
TYPE STATE_TYPE IS (s0, s1, s2, s3);
signal state: STATE_TYPE;
signal clk_delayd : std_logic ;
signal input_new : std_logic_vector(1 downto 0);
signal cnt : std_logic_vector(11 downto 0);
BEGIN

PROCESS (clk)
BEGIN
IF (clk'EVENT AND clk = '1') THEN
cnt <= cnt + 1;
IF (cnt = 2048) THEN
clk_delayd <= '1' ;
ELSIF (cnt =0) THEN
clk_delayd <= '0';
else
null;
END IF;
END IF;
END PROCESS;
in this way you can get the aera decreased and timing slack increased.

Added after 7 minutes:

a even beter way :
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY main IS
PORT(
input_old : in std_logic_vector( 1 downto 0);
clk, pb : in std_logic;
output : OUT STD_LOGIC_VECTOR(10 downto 0));
END main;

ARCHITECTURE struct OF main IS
TYPE STATE_TYPE IS (s0, s1, s2, s3);
signal state: STATE_TYPE;
signal clk_delayd : std_logic ;
signal input_new : std_logic_vector(1 downto 0);
signal cnt : std_logic_vector(11 downto 0);
BEGIN

PROCESS (clk)
BEGIN
IF (clk'EVENT AND clk = '1') THEN
cnt <= cnt + 1;
END IF;
end process;
clk_delayd <= cnt(11);

END PROCESS;
 

Code:
null;???
uhmm
how it wotks??
im doing now a trafic ligth ..
pls help me..
thx
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top