implementation of traffic light...

D

danddad61

hi all,
i'm new in the area of vhdl.
and i need to do a traffic light that turn the red light for 10 second.
the yellow light to 4 second and the green light for 2 seconds.
it's maybe sound simple program in vhdl.
but who can help me and say how to program it.
and what is the machine statement for this.
thank's all...
 
T

Thomas Stanka

and i need to do a traffic light that turn the red light for 10 second.
the yellow light to 4 second and the green light for 2 seconds.

Tell your teacher that no one needs such a ridicoluos bad traffic
light. He missed a yellow phase between green and red, together with
only 2 sec green this will lead to horrible traffic jams.
it's maybe sound simple program in vhdl.
but who can help me and say how to program it.

architecture programm of trafficjam is
type traffic_light_t is (red, green, yellow);
begin
program: process
variable traffic_light is traffic_light_type;
begin
traffic_light := red;
wait for 10 sec;
traffic_light=yellow;
wait for 4 sec;
traffic_light = green;
wait for 2 sec;
end process;
and what is the machine statement for this.
thank's all...

You sure you will manage to do the following steps to your master of
copy&paste yourself?

best regards

Thomas
 
D

danddad61

Hi Thomas,
first of all thank's for the fast reply.
i don't know also why he want such a traffic light.
about your program...
i don't need to initialize an entity at all?
something like:
entity lights is
port (CLK: in STD_LOGIC;
GO_GREEN: in STD_LOGIC;
GO_RED: in STD_LOGIC;
GO_YELLOW: in STD_LOGIC;
LIGHT_GREEN: out STD_LOGIC;
LIGHT_RED: out STD_LOGIC;
LIGHT_YELLOW: out STD_LOGIC);
end;
and what the circle that the traffic light need to do?
when the green light finish he need to go back to be red and so on...
how he do that in your code? and how i do it in real?
and what about a clk, i don't need to use one for geting a real seconds?

thank's
dan
 
J

John Speth

Hi Thomas,
first of all thank's for the fast reply.
i don't know also why he want such a traffic light.
about your program...
i don't need to initialize an entity at all?
something like:
entity lights is
port (CLK: in STD_LOGIC;
GO_GREEN: in STD_LOGIC;
GO_RED: in STD_LOGIC;
GO_YELLOW: in STD_LOGIC;
LIGHT_GREEN: out STD_LOGIC;
LIGHT_RED: out STD_LOGIC;
LIGHT_YELLOW: out STD_LOGIC);
end;
and what the circle that the traffic light need to do?
when the green light finish he need to go back to be red and so on...
how he do that in your code? and how i do it in real?
and what about a clk, i don't need to use one for geting a real seconds?

This is the part where you get to do the work now. Mr Stanka threw you
a very generous bone. He probably already has his EE degree. It's time
for you to earn yours.

I recommend you experiment and iterate using a test bench simulator.
That's where you'll find your answers.

JJS
 
T

Thomas Stanka

Hi Thomas,
first of all thank's for the fast reply.
i don't know also why he want such a traffic light.
about your program...
i don't need to initialize an entity at all?

You always need an entity. Don't expect me to write basics down for
you. The code from me is not even syntactically correct.

You asked for a program, and I gave you one. It will do what is needed
include looping infinite, but you cannot expect this to be simple
converted into real hardware.

To get real hardware you would need first to learn the difference
between a program (software) and a circuit (hardware). If you don't
know these differences, and understand why there is a reason to have
both possibilities in VHDL you will have a hard time till you have
your first own circuit running.

If you think about a circuit, you need to think about hardware
representations for time, lightbulbs, and so one. But why would this
circuit traffic light have some inputs called "go_green"?
This is a question to be answered by the guy who invents the system.
If you like me to invent your system, you should be able to pay me.
Else it will be your task.
and what about a clk, i don't need to use one for geting a real seconds?

Yes you will need a source that allows you to tell, when a second has
passed. This can be a (precise) clock for your design, or an cyclic
pulse that is not used as clock in your design, but represents a clock
on system level.

bye Thomas
 
R

rickman

Hi Thomas,
first of all thank's for the fast reply.
i don't know also why he want such a traffic light.
about your program...
i don't need to initialize an entity at all?
something like:
entity lights is
port (CLK: in STD_LOGIC;
GO_GREEN: in STD_LOGIC;
GO_RED: in STD_LOGIC;
GO_YELLOW: in STD_LOGIC;
LIGHT_GREEN: out STD_LOGIC;
LIGHT_RED: out STD_LOGIC;
LIGHT_YELLOW: out STD_LOGIC);
end;
and what the circle that the traffic light need to do?
when the green light finish he need to go back to be red and so on...
how he do that in your code? and how i do it in real?
and what about a clk, i don't need to use one for geting a real seconds?

thank's
dan

I don't know what grade you will get, but I think your professor should
get an F for how poorly he has prepared you for this assignment. If you
don't understand VHDL well enough to know what is happening in the
program Thomas gave you and what the problems are with using it, there
is no chance you will complete this assignment.

What book are you using? Where are you in the book. What has been
covered in class so far?

Here is a hint... "wait for xxx sec;" is not synthesizable in hardware.
So you need to think of another way of controlling the timing. If you
weren't using an HDL, but were designing this using schematics, how
would you control the timing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top