Solve 8:1 Mux Simulation with C Program

  • Thread starter Thread starter TimFortin
  • Start date Start date
  • Tags Tags
    Simulation
Click For Summary
SUMMARY

The discussion focuses on simulating an 8:1 multiplexer (MUX) using a C program with logical operators (&&, ||, and !). The user initially struggles to incorporate the eight source inputs into their solution, relying instead on a boolean expression derived from the three control inputs. A definitive solution is provided, demonstrating how to assign the control inputs (s0, s1, s2) and source inputs (a0 to a7) to produce the correct output. Additionally, the suggestion to utilize two 4:1 MUXes and one 2:1 MUX is presented as an alternative approach.

PREREQUISITES
  • Understanding of multiplexer functionality and operation
  • Proficiency in C programming, specifically with logical operators
  • Familiarity with boolean algebra and expressions
  • Basic knowledge of hardware description languages (HDL) like Verilog or VHDL
NEXT STEPS
  • Implement the C program for an 8:1 multiplexer using the provided boolean expression
  • Explore the design and implementation of multiplexers using Verilog or VHDL
  • Study the principles of boolean algebra to enhance understanding of logical operations
  • Research the differences between 4:1 and 2:1 multiplexers and their applications
USEFUL FOR

Students studying digital logic design, C programmers interested in hardware simulation, and engineers looking to understand multiplexer implementations.

TimFortin
Messages
1
Reaction score
0

Homework Statement


Hello all, this is my first post here although I've used this site for referencing several times. My question is regarding an 8:1 multiplexer. I need to write a c program using just &&, || and ! to simulate each gate of an 8:1 mux. We have 3 control inputs and 8 source inputs and need to have just a single output. I don't understand what the need of the 8 source inputs is when you can get the correct output by using a boolean expression on the three control inputs. So to simplify my question, how do i turn the 11 (8 source + 3 control) inputs into 1 output.
Thanks for looking


Homework Equations


ans = (!a && !b) + (!a &&b &&c) + (a && !b && !c);
This produces correct answer but does not use the source inputs at all


The Attempt at a Solution


My attemp at a solution is the equation i posted above, as well as trying to use 2 4:1 muxes and a 2:1 mux but i can't seem to make any sense of it.
 
Physics news on Phys.org
TimFortin said:

Homework Statement


Hello all, this is my first post here although I've used this site for referencing several times. My question is regarding an 8:1 multiplexer. I need to write a c program using just &&, || and ! to simulate each gate of an 8:1 mux. We have 3 control inputs and 8 source inputs and need to have just a single output. I don't understand what the need of the 8 source inputs is when you can get the correct output by using a boolean expression on the three control inputs. So to simplify my question, how do i turn the 11 (8 source + 3 control) inputs into 1 output.
Thanks for looking


Homework Equations


ans = (!a && !b) + (!a &&b &&c) + (a && !b && !c);
This produces correct answer but does not use the source inputs at all


The Attempt at a Solution




My attemp at a solution is the equation i posted above, as well as trying to use 2 4:1 muxes and a 2:1 mux but i can't seem to make any sense of it.

>The first thing I want to ask is that do you know how a multiplexer works?
This is because the code that you have pasted shows that you do not fully understand how a multiplexer works.


>if you use "s0,s1,s2" as the control inputs and "a0,a1,a2,a3,a4,a5,a6,a7" as the input pins while "ans" is ur answer then the C program must assign these inputs and switches to answer in the following manner...


ans=(!s0 && !s1 && !s2 && a0 )||(s0 && !s1 && !s2 && a1 )||(!s0 && s1 && !s2 && a2 )||(s0 && s1 && !s2 && a3 )||.... till all possible values of s0,s1,s2 have been utilized.

>If you are inclined to use two 4:1 muxes and one 2:1 then you can make them the same way the 8:1 mux is made. If you still don't understand then PM me or post here.


>If you are not forced to make this program in C then i would suggest that you program it in HDL(hardware descriptive languages) like Verilog and VHDL which are meant for hardware design and verification and have nearly the same syntax like C.

I hope your problem is solved.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 6 ·
Replies
6
Views
19K
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
6K
Replies
6
Views
4K