Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

how to getNAND/NOR on a calculator?

Options
  • 14-11-2009 1:20am
    #1
    Closed Accounts Posts: 7,134 ✭✭✭


    Howdy

    I have a calc with all them boolean functions, but can I get NAND/NOR ?

    I currently have not/and/or/xor/xnor

    Its been a decade since I did karnaugh maps and/or boolean algebra.

    Thanks.


Comments

  • Closed Accounts Posts: 1,397 ✭✭✭Herbal Deity


    Howdy

    I have a calc with all them boolean functions, but can I get NAND/NOR ?

    I currently have not/and/or/xor/xnor

    Its been a decade since I did karnaugh maps and/or boolean algebra.

    Thanks.
    NAND = NOT AND
    NOR = NOT OR

    X NAND Y = NOT (X AND Y)
    X NOR Y = NOT (X OR Y)

    Pretty simple when you've got NOT, AND and OR.


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    NAND = NOT AND
    NOR = NOT OR

    X NAND Y = NOT (X AND Y)
    X NOR Y = NOT (X OR Y)

    Pretty simple when you've got NOT, AND and OR.

    Ah, righty

    so I have these example..

    a) 10010 b) 11011

    a) NOR b) = NOT (10010 or 11011)

    = > 1111100100

    ? is that right?


    actually im trying to do bitwise (unary) operations ..

    say NOR > 10010

    So, I need to nor all the bits and end up with a single digit outcome.

    for 1001, the answer for a NOR should be 0

    but cant figure this out...??


  • Closed Accounts Posts: 1,397 ✭✭✭Herbal Deity


    OR doesn't concatinate bit strings, it's a logical operator. Your answer should be 5 bits long.

    10010 NOR 11011 = NOT (10010 OR 11011) = NOT (11011) = 00100


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    OR doesn't concatinate bit strings, it's a logical operator. Your answer should be 5 bits long.

    10010 NOR 11011 = NOT (10010 OR 11011) = NOT (11011) = 00100


    so how does the NOR of 1001 work out then as '0'??!

    I got a huge answer on my calculator, the very last [lsb] was 0

    so this seemed the answer, not sure why tho..


  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,171 Mod ✭✭✭✭Jonathan


    so how does the NOR of 1001 work out then as '0'??!

    I got a huge answer on my calculator, the very last [lsb] was 0

    so this seemed the answer, not sure why tho..
    What are you NOR'ing 1001 with?


  • Advertisement
  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    With itself...

    :D

    its a unary operation for verilog


    these are the syntax

    Operator


    Description

    & and

    ~& nand

    | or

    ~| nor

    ^ xor

    ^~ or ~^ xnor


    initial begin
    4 // Bit Wise AND reduction
    5 $display (" & 4'b1001 = %b", (& 4'b1001));
    6 $display (" & 4'bx111 = %b", (& 4'bx111));
    7 $display (" & 4'bz111 = %b", (& 4'bz111));
    8 // Bit Wise NAND reduction
    9 $display (" ~& 4'b1001 = %b", (~& 4'b1001));
    10 $display (" ~& 4'bx001 = %b", (~& 4'bx001));
    11 $display (" ~& 4'bz001 = %b", (~& 4'bz001));
    12 // Bit Wise OR reduction
    13 $display (" | 4'b1001 = %b", (| 4'b1001));
    14 $display (" | 4'bx000 = %b", (| 4'bx000));
    15 $display (" | 4'bz000 = %b", (| 4'bz000));
    16 // Bit Wise NOR reduction
    17 $display (" ~| 4'b1001 = %b", (~| 4'b1001));
    18 $display (" ~| 4'bx001 = %b", (~| 4'bx001));
    19 $display (" ~| 4'bz001 = %b", (~| 4'bz001));
    20 // Bit Wise XOR reduction
    21 $display (" ^ 4'b1001 = %b", (^ 4'b1001));
    22 $display (" ^ 4'bx001 = %b", (^ 4'bx001));
    23 $display (" ^ 4'bz001 = %b", (^ 4'bz001));
    24 // Bit Wise XNOR
    25 $display (" ~^ 4'b1001 = %b", (~^ 4'b1001));
    26 $display (" ~^ 4'bx001 = %b", (~^ 4'bx001));
    27 $display (" ~^ 4'bz001 = %b", (~^ 4'bz001));
    28 #10 $finish;
    29 end
    30
    31 endmodule


    answers >>>

    & 4'b1001 = 0
    & 4'bx111 = x
    & 4'bz111 = x
    ~& 4'b1001 = 1
    ~& 4'bx001 = 1
    ~& 4'bz001 = 1
    | 4'b1001 = 1
    | 4'bx000 = x
    | 4'bz000 = x
    ~| 4'b1001 = 0
    ~| 4'bx001 = 0
    ~| 4'bz001 = 0
    ^ 4'b1001 = 0
    ^ 4'bx001 = x
    ^ 4'bz001 = x
    ~^ 4'b1001 = 1
    ~^ 4'bx001 = x
    ~^ 4'bz001 = x



    for unary operations only 1 bit is the answer

    its like each bit is anded, nored, etc with each other until you are left with a single one..


  • Registered Users Posts: 10,636 ✭✭✭✭28064212


    Ok, first of all, there's no way anyone could have got it without you saying it was from Verilog. Unary reduction operators are not exactly common, and have little relation to their bitwise counterparts.

    Ok, given the NOR truth-table:
    p    q  |  Result
    ========================
        0    0  |    1
        1    0  |    0
        0    1  |    0
        1    1  |    0
    
    You NOR the first two bits (reading left-to-right) of your operand, then NOR the result with the next bit until you get your one-bit answer. For 1001, you would NOR 1 and 0, giving you 0, and your operand would now be 001. Then you NOR 0 and 0, giving you 1, and youroperand is now 11. You NOR 1 and 1, and that gives you your final answer of 0

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, dark mode, and more). Now available through your browser's extension store.

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    I got it now

    thanks ::)


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    actually,

    sorry for this nobish questions


    all unary talk here

    but if I AND say 1001

    to get 0

    then the NAND of this is 1, right

    likewise

    if I OR 1001 .. > 1

    the NOR is > 0


    also. say x = 10010

    exor this is 0 ?

    Ya?

    or do I step thru the bits individually, or does it make any difference to the outcome if you get my gist.


Advertisement