Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. PP Code Explanation
  2.  
  3. The Arduino implementation is largely similar to the Breadboard implementation, from its steps to its logic.
  4.  
  5. To begin, we declare multiple variables:
  6. Line 01: an int clock, starting at 0, which serves as an internal timer.
  7. Line 02: an int nibbleselector, which holds the state of the machine (show upper, lower, or sum of nibbles).
  8. Line 03-06: assignments of input pins (relative to ROM). The Arduino module will output a 4-bit binary integer with D as most signifiant.
  9. Line 07-14: assignments of output pins (relative to ROM). The Arduino module will accept an 8-bit binary integer with 7 as most signifianct.
  10. The void setup() block (Lines 16-29) uses pinMode() function to properly assign Lines 03-06 as input and Lines 07-14 as output.
  11.  
  12. Phase 1: The I-Region
  13. Step 1: The Clock to Binary Encoder
  14. The Arduino module uses the value of int clock to determine the amount of seconds passed. Int clock increments by 1 every second via the delay(1000) at Line 148-149. Int clock would also reset to 0 once it increments to 8 (Line 150). This simulates a clock ticking every second. The value of clock would be checked by a series of if-elseif blocks (Line 34-81) which converts the decimal into a 4-bit binary integer. Each bit would be fed into the ROM via parallel-out wire system thingy.
  15.  
  16. The result would be an 8-bit binary integer called I-REGION fed into the Arduino module from the ROM.
  17.  
  18. Step 2: The Nibble Selector
  19. The I-REGION is divided into two parts, OPCODE (Operational Code) and DREG-AD (D-REGION Address). OPCODE is a 5-bit integer from 0x03 to 0x07.
  20. An OPCODE of 00000 would set the machine to State 0, 00001 to State 1, and 00010 to State 2. No other states exist. Since the OPCODEs differ
  21. only in the two least significant digits, only 0x04 and 0x03 would be used.
  22. Lines 84-85 assign the two digits to variables, mage1 and mage2. These two variables then decide the machine state, nibbleselector, via conditional statements (Line 86-94).
  23.  
  24. Phase 2: The D-Region
  25. Step 1: DREG-AD Quicksave
  26. The DREG-AD from the I-Region is temporarily saved on variables "dregionaddress" (Lines 98-100).
  27.  
  28. Step 2: DREG-AD to ROM
  29. The Arduino module will feed dregionaddresses as inputs to the ROM IC. Note that ROMinput_D, the most signficant bit, will always be HIGH in order to access 0x08 to 0x0F in the ROM.
  30. The result is an 8-bit integer from the ROM fed into Arduino via wires.
  31.  
  32. Step 3: DREGION Quicksave
  33. Each integer is saved into 8 variables "dvaluei" where i is [0,7]. (Line 109-116).
  34.  
  35. Step 4: Actual Thingy
  36. Using the value of nibbleselector, the machine would perform one of three actions, dictated by if-elseif statements:
  37. Line 119-123: A nibbleselector value of 0 makes the Arduino module output the upper nibble (dvalue7 to dvalue4 where 7 is MSB).
  38. Line 125-130: A nibbleselector value of 1 makes the Arduino module output the lower nibble (dvalue3 to dvalue0 where 3 is MSB).
  39. Line 131-144: A nibbleselector value of 2 makes the Arduino do some crazy math stuff. The upper and lower nibbles are treated as two 4-bit integers, which will undergo a painful addition process via adders.
  40. Addition is composed of two parts: produceSum (Line153-178) which is a complicated XOR gate with fan-in of 3. produceCarry (Line 180-205) is a set of three AND gates with fan-in of 2 and an OR gate with fan in of 3.
  41. These two parts basically replicate a logic-gate ripple carry adder or whatever it's called.
  42.  
  43. In all three states, the Arduino module would produce an output via the Analog Out pins, which are connected to a BCD-to-7segment display thingy.
  44.  
  45. And there you go. please give me 3.0 plz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement