1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: 8:1 mux simulation

  1. Feb 6, 2009 #1
    1. The problem statement, all variables and given/known data
    Hello all, this is my first post here although Ive 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

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

    3. 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 cant seem to make any sense of it.
  2. jcsd
  3. Feb 7, 2009 #2
    >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 dont 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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook