home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FPGAWKII.ZIP / ADD.PDS next >
Text File  |  1995-04-05  |  935b  |  35 lines

  1. CHIP add IFX780_84
  2.  
  3. PIN a[0:7]      ; 8-bit a input
  4. PIN b[0:7]      ; 8-bit b input
  5. PIN sum[0:7]    ; 8-bit sum of a+b
  6. PIN cry[1:7]    ; 7 bits of carry info
  7. PIN 47 clk      ; shift-reg clock
  8. PIN 48 shift    ; shift-reg enable
  9. PIN 49 in       ; shift-reg input
  10. PIN 50 unused1  ; unused pins that are
  11. PIN 51 unused2  ;  connected to the PC
  12. PIN 77 unused3  ;  printer port so we
  13. PIN 78 unused4  ;  make sure they are
  14.                 ;  not used elsewhere
  15. EQUATIONS
  16.  
  17. ; this builds two concatenated 8-bit
  18. ; shift registers which shift only
  19. ; when shift is high
  20. a0     := in
  21. a[7:1] := a[6:0]
  22. b0     := a7
  23. b[7:1] := b[6:0]
  24. a[7:0].ACLK = clk * shift
  25. b[7:0].ACLK = clk * shift
  26.  
  27. ; these are the equations for an 8-bit
  28. ; ripple-carry adder
  29. sum0     = a0 :+: b0
  30. sum[7:1] = a[7:1] :+: b[7:1] :+: cry[7:1]
  31. cry1     = a0 * b0
  32. cry[7:2] = a[6:1] * b[6:1] +
  33.            a[6:1] * cry[6:1] +
  34.            b[6:1] * cry[6:1]
  35.