Create a console ‘C’ application to perform the following three input logic functions

Task 1

Create a console ‘C’ application to perform the following three input logic functions. Your application should be user friendly.

  1. Logic Functions
  2. AND
  3. OR
  4. NAND
  5. NOR
  6. EXOR
  7. Shift Left
  8. Shift Right

All of the above binary functions has two inputs (AND,OR etc.) except Shift operations and the output must be displayed as binary number format.  User could be asked to enter binary numbers to proceed with the specific operation. Error messages may be displayed, if the user enter non-binary values.

 

  1. Mathematical Equation
  2. Simple correlation function

Following mathematical function, explain the basic correlation function. This function may accept 10 input samples(x1,x2) to produce output. Detail explanations as shown below.

Where,

N          – Total Number of samples

– Samples 1

– Samples 2

n          – Integer number

 

The followings example shows the calculation for the 9 input samples

n 1 2 3 4 5 6 7 8 9
4 2 -1 3 -2 -6 -5 4 5
-4 1 3 7 4 -2 -8 -2 1

 

) = 5

 

  1. Expand the above equation to create a C function, which accepts buffer pointers and accept a user-defined number of samples to determine size of the buffer

 

  1. Simulating the CPU with 8 bit instruction

 

Create a function called “void cpu_simulation(unsigned char *PC, unsigned char *memory, unsigned char *run)”, which accepts 10 memory buffer pointers, pointer to PC and run. The details description as below.

 

Following the flowchart, illustrate the execution sequence of a CPU instruction. Implement this process in C, within the function call.

This content is for IT & Web programming task members only.
Log In Register