Truth Table Implementation

Discussion in 'VHDL' started by shibu, Aug 24, 2003.

  1. shibu

    shibu Guest

    Hi All,
    I have several truth tables like the following

    I/P1 I/P2 I/P3 I/P4 => O/P1, I/P1 I/P2 I/P3 => O/P1 O/P2, I/P1 I/P2
    I/P3 => O/P1 O/P2 O/P3 etc.

    I need to implement this as C code. What is the best way to implement
    this. I know SOP/POS will help me to simplify the truth tables.Is
    there any alternative way to solve this. Any generic/optimized way to
    solve this?
    Is there any lookup ideas to help me, so that I can say "N" Inputs and
    "Y" outputs...

    Regards
    Shibu
    shibu, Aug 24, 2003
    #1
    1. Advertising

  2. shibu

    Roadie Roger Guest

    (shibu) wrote
    > I have several truth tables like the following
    >
    > I/P1 I/P2 I/P3 I/P4 => O/P1, I/P1 I/P2 I/P3 => O/P1 O/P2, I/P1 I/P2
    > I/P3 => O/P1 O/P2 O/P3 etc.
    >
    > I need to implement this as C code. What is the best way to implement
    > this. I know SOP/POS will help me to simplify the truth tables.Is
    > there any alternative way to solve this. Any generic/optimized way to
    > solve this?
    > Is there any lookup ideas to help me, so that I can say "N" Inputs and
    > "Y" outputs...


    Are you using some kind of compiler/optimiser that will let you look
    at the optimised equations? To state the obvious, if you have a total
    of N states and inputs you have a lookup table of 2^N entries. The
    width of each entry is the number of outputs you have. If you have a
    limited number of inputs and lots of memory, the solution is
    straightforward. Roadie Roger
    Roadie Roger, Aug 30, 2003
    #2
    1. Advertising

  3. (shibu) wrote in message news:<>...
    > Hi All,
    > I have several truth tables like the following
    >
    > I/P1 I/P2 I/P3 I/P4 => O/P1, I/P1 I/P2 I/P3 => O/P1 O/P2, I/P1 I/P2
    > I/P3 => O/P1 O/P2 O/P3 etc.
    >
    > I need to implement this as C code. What is the best way to implement
    > this. I know SOP/POS will help me to simplify the truth tables.Is
    > there any alternative way to solve this. Any generic/optimized way to
    > solve this?
    > Is there any lookup ideas to help me, so that I can say "N" Inputs and
    > "Y" outputs...
    >
    > Regards
    > Shibu


    You have a set of dependences of your boolean function. In case that
    there is only one function satisfying these dependences, they define
    a truth table. The simplest way is to define a set of n k-dimensional
    character arrays for a function from 2**k to 2**n (n boolean functions
    with k arguments). In you case this might be
    'unsigned char arr[4][2][2][2][2];' - n and k are equal to 4..

    First, set all the elements of the arrays to some illegal boolean value,
    e.g. 'memset(arr, 3, sizeof(arr))'. Then, for every rule, set the array
    values to satisfy the rule - 'arr[0][1][1][1][1] = 0;' etc. For consistency
    check, test if you ever change a value from 1 to 0 or vice versa -
    in this case there is NO truth table satisfying your rules. When you
    finished, test if there is an undefined value in the tables, a character
    equal to 3 in our case. If this happens, your rules don't completely
    define a set of boolean functions.

    If you succeeded to build a lookup table, you can see the value
    of the result Qi as 'arr[p1][p2]...'.

    Good luck!

    Michael
    Michael Tiomkin, Sep 2, 2003
    #3
  4. shibu

    Mario Trams Guest

    shibu wrote:

    > Hi All,
    > I have several truth tables like the following
    >
    > I/P1 I/P2 I/P3 I/P4 => O/P1, I/P1 I/P2 I/P3 => O/P1 O/P2, I/P1 I/P2
    > I/P3 => O/P1 O/P2 O/P3 etc.
    >
    > I need to implement this as C code. What is the best way to implement
    > this. I know SOP/POS will help me to simplify the truth tables.Is
    > there any alternative way to solve this. Any generic/optimized way to
    > solve this?
    > Is there any lookup ideas to help me, so that I can say "N" Inputs and
    > "Y" outputs...


    Using a lookup table for speed-optimization or a language description
    (i.e. boolean logic coding) for size-optimization ???

    Regards,
    Mario
    Mario Trams, Sep 4, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mario

    Truth Table

    Mario, Jul 9, 2003, in forum: C++
    Replies:
    2
    Views:
    687
    John Harrison
    Jul 10, 2003
  2. PerritoPerron

    Truth Table help

    PerritoPerron, Jul 13, 2003, in forum: C++
    Replies:
    5
    Views:
    535
    John Harrison
    Jul 13, 2003
  3. Replies:
    0
    Views:
    454
  4. Tony Johansson

    problem with a truth table

    Tony Johansson, Aug 18, 2005, in forum: C++
    Replies:
    6
    Views:
    380
    ikinal
    Aug 18, 2005
  5. marco.marsella

    Truth Table: Help !

    marco.marsella, Mar 3, 2010, in forum: VHDL
    Replies:
    2
    Views:
    809
    JohnDuq
    Mar 5, 2010
Loading...

Share This Page