Lab 2
During this lab your are asked to write a simple VHDL program for a behavioral design. The block schema of the design is the following:
This design should determine the position of a “marker” in the line of 8
possible locations (see ilustration down).
The “marker” can only be in exact location and can move only along the
line towards or backwards with the step of one location. This movement should
take 1 sec.
Input specifies desirable position of the “marker”. Input
is of type bit_vector of length 8. Input has only
one bit up, others are down. The position of ‘1’ in bit_vector
shows where we want to move the “marker”. We need to move “marker” towards or
backwards according to the current position of the “marker” and input. When we
reach required position we stop.
Output state is of type bit_vector with length 2 and
it shows, what we are doing with the "marker":
· “10” moving towards (this means in
direction from 0 to 7);
· “01” moving backwards (in direction from 7
to 0);
· “00” stop.
Output position is of type integer and shows what is
the current position of the "marker" in the line of locations.
Initial position of the "marker" is in 0-location.
Task:
Write the behaviour of the system according to the given specification.
Simulate your behaviour in order to get correct results (you can use either ModelSim or Synopsys to
simulate). Here is the entity for your
system positioning.vhd and the testbench t_positioning.vhd to control the correctness of
the behaviour.
It is allowed to make this lab in pairs.
Clue:
In order to get output every 1 sec, activate your process with the
statement wait for 1 sec; You can use several processes.
Requirements:
· written code with comments added to the
report;
· waveform picture added to the report;
· description of the solution.
Quiestions:
· Can you read signal state?
What should be rewritten to change the readability status?
· How long does it take to execute the for
loop? Does it depend on the number of iterations?
Example:
1)
we are in
initial state, this means "marker" is in 0-cell.
input<=”00010000”;
in the output we should observe the following
· time: 1 sec
state: “10”
position: 1
· time: 2 sec
state: “10”
position: 2
· time: 3 sec
state: “00”
position: 3
· time: 4 sec
state: “00”
position: 3
Example realization: