User Tools

Site Tools


notes:discrete:fall2022:projects:lmr0

This is an old revision of the document!


BACKGROUND

This project is inspired by an idea from DirtPig and Paradox.

How do the math functions from the math.h library work? How can you add, subtract, divide, multiply, raise to a power, find a root, etc. without using binary operators? What is the logic behind your day-to-day mathematic operations? and how can you teach it to a computer?

LOGIC GATES

–Note that 0=false and 1=true–

NOT-Is fed one value, returns true if the value is false
AND-Is fed two values, returns true if both values are true
OR-Is fed two values, returns true if any value is true
NOR-Is fed two values, returns true if neither value is true
XOR-Is fed two values, returns true if only one value is true
XNOR-Is fed two values, returns true if both values are true or if both values are false
NAND-Is fed two values, returns true unless both values are true

SHIFT-Is fed an array of bits |1|0|1|0|,if we shift left, then we have |0|1|0|0|. If we keep going then the remaining 1 will fall off and we will have |0|0|0|0|. Will only ever add 0 to the array.

ROTATE-Is fed an array of bits |1|0|1|0|0|, if we rotate left then we get |0|1|0|0|1|. Will put the bit that falls off in the new bit spot created.

SPECIFICATIONS

We will be pseudo-creating a math library by creating a 12-element array and functions to perform all basic operands.

This week we will be replicating the functionality of the seven basic logic gates and creating our own bitwise operations:

  • Not
  • And
  • Nand
  • Or
  • Nor
  • Xor
  • Xnor
  • Logical shift (potentially 2 separate operations, shift left and shift right)
  • Logical rotate

We will be writing different functions that will have this functionality.

You must define your own set of values that represent the value true/on and false/off. Could be the traditional TRUE or FALSE, 1 or 0.

You will not use the already included bitwise operators from C, since we are creating our own.

*Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project.

*For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash

PROGRAM

OUTPUT SPECIFICATIONS

VERIFICATION

notes/discrete/fall2022/projects/lmr0.1663893624.txt.gz · Last modified: 2022/09/23 00:40 by abarbcal