Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The implementation for func_increment() should just be this, as we were not given anything else relating to it: void func_increment(int a[], int result[]); Lab# Date

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The implementation for func_increment() should just be this, as we were not given anything else relating to it: void func_increment(int a[], int result[]);

Lab# Date Title Grade Release Date Lab 08 Week 08 Truth Table Due Date March 02, 2021 Tuesday Midnight AoE Wednesday 7 AM EDT March 08, 2021 This lab's objectives will be to master the topics in logic circuit design by implementing the algorithms with a programming language, herein, C/C++. Step 1. Environment Setup Our programming environment is the same as the first lab (Lab 01). In this lab, we want to start a new series of labs about designing a logic circuit. Particularly, in this lab, we want to create a truth table for a given number of input binary variables and output binary variables. 1) As we discussed in the lectures, the first step in designing a logic circuit is to build a truth table with columns for input binary variables and columns for output binary variables. Also, we have to create rows for different values of the input binary variables, either 0 or 1 for each input binary variable. For example, given 3 input binary variables and 1 output binary variable, the truth table would have 4 columns and 23=8 rows. 2) Next, we have to pick names for the input and output binary variables. For instance, for 3 input binary variables, we can choose Z, Y, X and for the single output binary variable, we can choose F. 3) Then, we have to look at those rows that make the output binary variable 1 and write the output binary variable as a Boolean function (expression) of the input binary variables in the form of a sum of minterms (canonical sum of products). For instance, F = m(0,2,3) = Z'Y'X' + Z'YX' + Z'YX. 4) Finally, we sketch the logic circuit using the schematic symbols of the NOT, AND and OR logic gates. In this lab, we want to write a program that does the 1st and 2nd steps. That is, we want to write a program that outputs the truth table. In the following code, I assume that there are 3 input binary variables (line#04), there is 1 output binary variable (line#05), and as a result, the truth table is going to have 2^(#input variables) = 23=8. I defined the truth table as a 2-D array of integer values with size 8 rows x 4 columns (line#15). Please pay attention that in C/C++, the '^' symbol is reserved for the bitwise XOR operator and cannot be used for the power operator (line#11,12). In C/C++, we can use the pow(a, b) function available in math.h library to return a to the power of b as shown in line#14. Also, note that the format specifier for char is "%c". 01 #include 02 #include 03 04 #define INPUT_VARIABLE_COUNT 3 05 #define OUTPUT_VARIABLE_COUNT 1 06 ez int main(void) { 08 09 setbuf(stdout, NULL); 10 11 //Wrong! ^ operator in C/C++ is the bitwise XOR logic operator. 12 //int TRUTH_TABLE_ROW_COUNT = 2^INPUT_VARIABLE_COUNT; 13 14 int TRUTH_TABLE_ROW_COUNT = (int) pow(2, INPUT_VARIABLE_COUNT); 15 int truth_table[TRUTH_TABLE_ROW_COUNT][INPUT_VARIABLE_COUNT + OUTPUT_VARIABLE_COUNT] = {@}; 16 const char variables[INPUT_VARIABLE_COUNT + OUTPUT_VARIABLE_COUNT] = {'Z', 'Y', 'X', 'F'}; 17 18 //printing the header of truth table with variable names for inputs and outputs 19 20 1/printing the header for input variables 21 for(int i = 0; i 02 #include 03 04 #define INPUT_VARIABLE_COUNT 3 05 #define OUTPUT_VARIABLE_COUNT 1 06 ez int main(void) { 08 09 setbuf(stdout, NULL); 10 11 //Wrong! ^ operator in C/C++ is the bitwise XOR logic operator. 12 //int TRUTH_TABLE_ROW_COUNT = 2^INPUT_VARIABLE_COUNT; 13 14 int TRUTH_TABLE_ROW_COUNT = (int) pow(2, INPUT_VARIABLE_COUNT); 15 int truth_table[TRUTH_TABLE_ROW_COUNT][INPUT_VARIABLE_COUNT + OUTPUT_VARIABLE_COUNT] = {@}; 16 const char variables[INPUT_VARIABLE_COUNT + OUTPUT_VARIABLE_COUNT] = {'Z', 'Y', 'X', 'F'}; 17 18 //printing the header of truth table with variable names for inputs and outputs 19 20 1/printing the header for input variables 21 for(int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago