3.5.1 Synopsis
The camera has a different button for each exposure time, i.e. the data signals from the keypad are transferred via a 10-bit data bus. If a button is pressed, the corresponding wire is set to 1.
The exposure times are calculated according to the following formula:
time(button) = 2^(-button), for button=0..9 (time in seconds).
The result (1/1 s, 1/2 s, 1/4 s, ..., 1/512 s) shall be shown on the 7-segment display. Thus, another decoder is needed. We will not introduce any new VHDL concepts in this exercise but suggest to try out different implementations and to observe their impact on the synthesis result.
The block diagram of the new module is rather simple.
The keypad decoder
|
-
Behaviour:
-
As already mentioned, the functionality of this module is fairly simple. The denominator of the following calculation shall be coded in a suitable form for the 7-segment display.
-
2^(-button) = 1 / (2^(button) ) = 1/1, 1/2, 1/4, 1/8, ..., 1/512 (button = 0..9)
-
It is up to you to decide about the behaviour when more than one button is pressed. There are basically two options: Either the buttons have a certain priority, or the user input is ignored.
-
Data types:
-
The input data is generated by an external keypad and consists of 10 wires, one per button. Thus a
std_ulogic_vector
is used for the KEYPAD signal. The decoded values shall be processed by the display logic, i.e.
T_DIGITS
is the most suitable data type.
-
To do:
-
Create new files for the decoder entity and its architectures if you want to try out different implementations. Remember that synthesis tools ignore the VHDL configuration and use the most recent architecture.
-
Generate a testbench for the new design and add stimuli that cover "illegal" user input (more than one button pressed simultaneously).
-
Compile the VHDL code (package->entity->architectures->configurations).
-
Simulate the configurations and look out for differences in the behaviour.
-
Synthesize the architectures and find out about their area and maximum delay from input to output.