Professional Documents
Culture Documents
lab reportالذويب
lab reportالذويب
lab reportالذويب
Lab report
ID: 022171912
Supervisor:احمد الذويب.د
Date:
Spring 2022
1. Abstract:
This experiment enables us to simulate a digital system designed from a given specifications
using C++ programming language.
2. Design specifications:
It’s required to simulate a design of a logic circuit for a car direction indicator using c++
programming language where the car moves either left, right or direct according to an activation
of one of the three direction lines.
Notes:
3. Pre-lab questions:
Q1. Write the truth table for the specifications
Q2. Drive the logic equations for the outputs using minimum sum of products form
Left=MLR’
Direct=MLDR+ML’R’
Right=MD’R+ML’R
After writing the truth table and using k-maps to find the equations for the outputs, we stated
writing the C++ program to simulate the functionality of the design.
We started by defining all the variables in the code which are the inputs M, L, D, R, and the
outputs Left, direct, and right, the we outputted a message to allow the user to input the values of
M, L, D, and R.
The first if statement was to make sure that if M=0 than the car is not moving (note #1), the next
if statement make sure that the user only used Boolean values for the inputs (0 or 1) and if not
the program will display a massage indicating that the used inputted wrong kind of data.
The first direction we tested was the left because it has priority (note #4) ,therefore when the
equation for Left output is true the rest outputs don’t get tested. Finally we tested for the Direct
and right directions.
5. Conclusion:
In this experiment we simulated the functionality of a car direction indicator using c++
programming language where we used given specifications to write a truth table then dived the
equations for the outputs which we used to write the program.