H3draut3r

mux41

Apr 28th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def and
  2.  
  3. port in ain1
  4. port in ain2
  5. port out aout
  6. net a1
  7.  
  8. inst and1 nand ain1 ain2 a1
  9. inst and2 nand a1 a1 aout
  10.  
  11. enddef
  12. #
  13. #
  14. #
  15. def or
  16.  
  17. port in oin1
  18. port in oin2
  19. port out oout
  20. net o1
  21. net o2
  22.  
  23. inst or1 nand oin1 oin1 o1
  24. inst or2 nand oin2 oin2 o2
  25. inst or3 nand o1 o2 oout
  26.  
  27. enddef
  28. #
  29. #
  30. #
  31. def not
  32.  
  33. port in nin
  34. port out nout
  35.  
  36. inst n1 nand nin nin nout
  37.  
  38. enddef
  39. #
  40. #
  41. #
  42. DEF mux41
  43.  
  44. port in i0
  45. port in i1
  46. port in i2
  47. port in i3
  48. port in s<1:0>
  49. port out z
  50. net m00
  51. net m01
  52. net m02
  53. net m03
  54. net m04
  55. net m05
  56. net m06
  57. net m07
  58. net m08
  59. net m09
  60. net ms1
  61. net ms2
  62. net ms3
  63. net ms4
  64.  
  65. inst mx01 not s<1> m00
  66. inst mx02 not s<0> m01
  67. inst mx03 and m00 m01 ms1
  68. inst mx04 not s<1> m02
  69. inst mx05 and m02 s<0> ms2
  70. inst mx06 not s<0> m03
  71. inst mx07 and m03 s<1> ms3
  72. inst mx08 and s<1> s<0> ms4
  73. inst mx09 and ms1 i0 m04
  74. inst mx10 and ms2 i1 m05
  75. inst mx11 and ms3 i2 m05
  76. inst mx12 and ms4 i3 m06
  77. inst mx13 or m04 m05 m07
  78. inst mx14 or m05 m06 m08
  79. inst mx15 or m07 m08 z
  80.  
  81. enddef
  82. #
  83. #
  84. #
  85. DEF TOP
  86.  
  87.   NET I0
  88.   NET I1
  89.   NET I2
  90.   NET I3
  91.   NET S<1:0>
  92.   NET Z
  93.   INST MUX41 MUX41 I0 I1 I2 I3 S<1:0> Z
  94.   INST TEST MUX41_TEST I0 I1 I2 I3 S<1:0> Z
  95.   INST OUTS1 IO_OUT S<1>
  96.   INST OUTS0 IO_OUT S<0>
  97.   INST OUTI0 IO_OUT I0
  98.   INST OUTI1 IO_OUT I1
  99.   INST OUTI2 IO_OUT I2
  100.   INST OUTI3 IO_OUT I3
  101.   INST OUTZ IO_OUT Z
  102.  
  103. ENDDEF
Advertisement
Add Comment
Please, Sign In to add comment