home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / self / contrib.lha / contrib / simulator / lib.self < prev    next >
Encoding:
Text File  |  1991-05-23  |  13.8 KB  |  362 lines

  1. "$ Revision: 1.0 $"
  2. "Copyright 1990:
  3.     Jecel Mattos de Assumpcao Jr.
  4.     LSI - EPSUP, Sao Paulo, SP, Brasil"
  5.  
  6.     " Simulation Libraries "
  7.  
  8. library _DefineSlots: ( |
  9.     basic* = ( |
  10.         pfet = ( |
  11.                 parent* = traits simulation component.
  12.                 sim**.
  13.                 dad.
  14.                 leaf.
  15.                 type = 'p channel MOS transistor'.
  16.                 drain. source. gate.
  17.                 declare = (
  18.                         drain: input.
  19.                         source: input.
  20.                         gate: input.
  21.                 ).
  22.                 behave = (
  23.                         gate net value isLow ifTrue: [
  24.                             set: gate To: oddballs levels chargeLow.
  25.                             set: drain To: source net value weaker After: 1.
  26.                         ].
  27.                         gate net value isHigh ifTrue: [
  28.                             set: gate To: oddballs levels chargeHigh.
  29.                             set: drain To: oddballs levels highImpedance.
  30.                         ].
  31.                         gate net value isUnknown ifTrue: [
  32.                             | z = oddballs levels highImpedance. |
  33.                             set: gate To: z.
  34.                             set: drain To: ( oddballs levels unknown
  35.                                 merge: z 
  36.                                    To: z
  37.                                  With: source net value highest weaker
  38.                                    To: source net value lowest weaker ).
  39.                         ].
  40.                 ).
  41.         | ).
  42.         nfet = ( |
  43.                 parent* = traits simulation component.
  44.                 sim**.
  45.                 dad.
  46.                 leaf.
  47.                 type = 'n channel MOS transistor'.
  48.                 drain. source. gate.
  49.                 declare = (
  50.                         drain: input.
  51.                         source: input.
  52.                         gate: input.
  53.                 ).
  54.                 behave = (
  55.                         gate net value isHigh ifTrue: [
  56.                             set: gate To: oddballs levels chargeHigh.
  57.                             set: drain To: source net value weaker After: 1.
  58.                         ].
  59.                         gate net value isLow ifTrue: [
  60.                             set: gate To: oddballs levels chargeLow.
  61.                             set: drain To: oddballs levels highImpedance.
  62.  
  63.                         ].
  64.                         gate net value isUnknown ifTrue: [
  65.                             | z = oddballs levels highImpedance. |
  66.                             set: gate To: z.
  67.                             set: drain To: ( oddballs levels unknown
  68.                                 merge: z 
  69.                                    To: z
  70.                                  With: source net value highest weaker
  71.                                    To: source net value lowest weaker ).
  72.                         ].
  73.                 ).
  74.         | ).
  75.         bdirNfet = ( |
  76.                 parent* = traits simulation component.
  77.                 sim**.
  78.                 dad.
  79.                 leaf.
  80.                 type = 'bidirectional n channel MOS transistor'.
  81.                 drain. source. gate.
  82.                 declare = (
  83.                         drain: input.
  84.                         source: input.
  85.                         gate: input.
  86.                 ).
  87.                 behave = (
  88.                         gate net value isHigh ifTrue: [
  89.                             | v. s. d. |
  90.                             s: source net value.
  91.                             d: drain net value. 
  92.                             set: gate To: oddballs levels chargeHigh.
  93.                             v:  s resolve: d.
  94.                             set: source To: v weaker After: 1.
  95.                             set: drain To: source net value"v weaker" After: 1.
  96.                         ].
  97.                         gate net value isLow ifTrue: [
  98.                             set: gate To: oddballs levels chargeLow.
  99.                             set: drain To: oddballs levels highImpedance.
  100.                             set: source To: oddballs levels highImpedance. 
  101.                         ].
  102.                         gate net value isUnknown ifTrue: [
  103.                             | z = oddballs levels highImpedance. |
  104.                             set: gate To: z.
  105.                             set: drain To: ( oddballs levels unknown
  106.                                 merge: z 
  107.                                    To: z
  108.                                  With: source net value highest weaker
  109.                                    To: source net value lowest weaker ).
  110.                             set: source To: ( oddballs levels unknown
  111.                                 merge: z 
  112.                                    To: z
  113.                                  With: drain net value highest weaker
  114.                                    To: drain net value lowest weaker ).
  115.                         ].
  116.                 ).
  117.         | ).
  118.         inverter = ( |
  119.                 parent* = traits simulation component.
  120.                 sim**.
  121.                 dad.
  122.                 leaf.
  123.                 type = 'inverter'.
  124.                 in. out.
  125.                 declare = (
  126.                         in: input.
  127.                         out: output.
  128.                        ).
  129.                 behave = ( set: out To: (in not) After: 2 ).
  130.                 n1. p1.
  131.                 netlist = (
  132.                     n1: ( get: library basic nfet ).
  133.                     p1: ( get: library basic pfet ).
  134.                     n1 gate to: in.
  135.                     p1 gate to: in.
  136.                     n1 drain to: out.
  137.                     n1 source to: gnd.
  138.                     p1 drain to: out.
  139.                     p1 source to: vdd.
  140.                 ).
  141.         | ).
  142.         nor2 = ( |
  143.                 parent* = traits simulation component.
  144.                 sim**.
  145.                 dad.
  146.                 leaf.
  147.                 type = '2 input NOR'.
  148.                 in1. in2. out.
  149.                 declare = (
  150.                         in1: input.
  151.                         in2: input.
  152.                         out: output.
  153.                        ).
  154.                 behave = ( set: out To: (in1 || in2) not After: 3 ).
  155.                 n1. n2. p1. p2.
  156.                 netlist = (
  157.                     n1: ( get: library basic nfet ).
  158.                     n2: ( get: library basic nfet ).
  159.                     p1: ( get: library basic pfet ).
  160.                     p2: ( get: library basic pfet ).
  161.                     n1 gate to: in1.
  162.                     n2 gate to: in2.
  163.                     p1 gate to: in1.
  164.                     p2 gate to: in2.
  165.                     n1 drain to: out.
  166.                     n2 drain to: out.
  167.                     n1 source to: gnd.
  168.                     n2 source to: gnd.
  169.                     p1 drain to: out.
  170.                     p2 drain to: p1 source.
  171.                     p2 source to: vdd.
  172.                 ).
  173.         | ).
  174.         nand2 = ( |
  175.                   parent* = traits simulation component.
  176.                   sim**.
  177.                   dad.
  178.                   leaf.
  179.                   type = '2 input NAND'.
  180.                   in1. in2. out.
  181.                   declare = (
  182.                           in1: input.
  183.                           in2: input.
  184.                           out: output.
  185.                          ).
  186.                   behave = ( set: out To: (in1 && in2) not After: 3 ).
  187.                 n1. n2. p1. p2.
  188.                 netlist = (
  189.                     n1: ( get: library basic nfet ).
  190.                     n2: ( get: library basic nfet ).
  191.                     p1: ( get: library basic pfet ).
  192.                     p2: ( get: library basic pfet ).
  193.                     n1 gate to: in1.
  194.                     n2 gate to: in2.
  195.                     p1 gate to: in1.
  196.                     p2 gate to: in2.
  197.                     n1 drain to: out.
  198.                     n2 drain to: n1 source.
  199.                     n2 source to: gnd.
  200.                     p1 drain to: out.
  201.                     p2 drain to: out.
  202.                     p1 source to: vdd.
  203.                     p2 source to: vdd.
  204.                 ).
  205.         | ).
  206.         or2 = ( |
  207.                 parent* = traits simulation component.
  208.                 sim**.
  209.                 dad.
  210.                 leaf.
  211.                 type = '2 input OR'.
  212.                 in1. in2. out.
  213.                 declare = (
  214.                         in1: input.
  215.                         in2: input.
  216.                         out: output.
  217.                        ).
  218.                 behave = ( set: out To: (in1 || in2) After: 5 ).
  219.                 nor. inv.
  220.                 netlist = (
  221.                     nor: ( get: library basic nor2 ).
  222.                     inv: ( get: library basic inverter ).
  223.                     nor in1 to: in1.
  224.                     nor in2 to: in2.
  225.                     nor out to: inv in.
  226.                     inv out to: out.
  227.                 ).
  228.         | ).
  229.         and2 = ( |
  230.                 parent* = traits simulation component.
  231.                 sim**.
  232.                 dad.
  233.                 leaf.
  234.                 type = '2 input AND'.
  235.                 in1. in2. out.
  236.                 declare = (
  237.                         in1: input.
  238.                         in2: input.
  239.                         out: output.
  240.                 ).
  241.                 behave = ( set: out To: (in1 && in2) After: 5 ).
  242.                 nand. inv.
  243.                 netlist = (
  244.                     nand: ( get: library basic nand2 ).
  245.                     inv: ( get: library basic inverter ).
  246.                     nand in1 to: in1.
  247.                     nand in2 to: in2.
  248.                     nand out to: inv in.
  249.                     inv out to: out.
  250.                 ).
  251.         | ).
  252.     | ).
  253.     ttl* = ( |
  254.     | ).
  255.     processor* = ( |
  256.     | ).
  257.     memory* = ( |
  258.         ocLatch = ( |
  259.                    parent* = traits simulation component.
  260.                    sim**.
  261.                    dad.
  262.                    leaf.
  263.                    type = 'one phase clock latch'.
  264.                    in. phi. out.
  265.                    declare = (
  266.                            in: input.
  267.                            phi: input.
  268.                            out: output.
  269.                    ).
  270.                    p1. p2. p3. p4. n1. n2. n3. n4. n5.
  271.                    netlist = (
  272.                        p1: ( get: library basic pfet ).
  273.                        p2: ( get: library basic pfet ).
  274.                        p3: ( get: library basic pfet ).
  275.                        p4: ( get: library basic pfet ).
  276.                        n1: ( get: library basic nfet ).
  277.                        n2: ( get: library basic nfet ).
  278.                        n3: ( get: library basic nfet ).
  279.                        n4: ( get: library basic nfet ).
  280.                        n5: ( get: library basic nfet ).
  281.                        "first stage"
  282.                        p1 source to: vdd.
  283.                        p1 drain to: p2 source.
  284.                        p2 drain to: n1 drain.
  285.                        n1 source to: gnd.
  286.                        p1 gate to: in.
  287.                        p2 gate to: phi.
  288.                        n1 gate to: in.
  289.                        "second stage"
  290.                        p3 source to: vdd.
  291.                        p3 drain to: n2 drain.
  292.                        n2 source to: n3 drain.
  293.                        n3 source to: gnd.
  294.                        p3 gate to: phi.
  295.                        n2 gate to: n1 drain.
  296.                        n3 gate to: phi.
  297.                        "third stage"
  298.                        p4 source to: vdd.
  299.                        p4 drain to: n4 drain.
  300.                        n4 source to: n5 drain.
  301.                        n5 source to: gnd.
  302.                        p4 gate to: n2 drain.
  303.                        n4 gate to: phi.
  304.                        n5 gate to: n2 drain.
  305.                        out to: n4 drain.
  306.                    ).
  307.         | ).
  308.         camCell = ( |
  309.                    parent* = traits simulation component.
  310.                    sim**.
  311.                    dad.
  312.                    leaf.
  313.                    type = 'one bit of Content Addressable Memory'.
  314.                    bit. bitb. word. match.
  315.                    declare = (
  316.                            bit: input.
  317.                            bitb: input.
  318.                            word: input.
  319.                            match: input.
  320.                    ).
  321.                    p1. p2. n1. n2. n3. n4. n5. n6. n7.
  322.                    netlist = (
  323.                        p1: ( get: library basic pfet ).
  324.                        p2: ( get: library basic pfet ).
  325.                        n1: ( get: library basic nfet ).
  326.                        n2: ( get: library basic nfet ).
  327.                        n3: ( get: library basic bdirNfet ).
  328.                        n4: ( get: library basic bdirNfet ).
  329.                        n5: ( get: library basic nfet ).
  330.                        n6: ( get: library basic nfet ).
  331.                        n7: ( get: library basic nfet ).
  332.                        p1 source to: vdd.
  333.                        p1 gate to: p2 drain.
  334.                        p1 drain to: p2 gate.
  335.                        p2 source to: vdd.
  336.                        n1 source to: gnd.
  337.                        n1 gate to: p1 gate.
  338.                        n1 drain to: p1 drain.
  339.                        n2 source to: gnd.
  340.                        n2 gate to: p2 gate.
  341.                        n2 drain to: p2 drain.
  342.                        n3 drain to: n1 drain.
  343.                        n3 gate to: word.
  344.                        n3 source to: bit.
  345.                        n4 drain to: n2 drain.
  346.                        n4 gate to: word.
  347.                        n4 source to: bitb.
  348.                        n5 drain to: n6 drain.
  349.                        n5 gate to: n1 drain.
  350.                        n5 source to: bit.
  351.                        n6 drain to: n7 gate.
  352.                        n6 gate to: n2 drain.
  353.                        n6 source to: bitb.
  354.                        n7 drain to: match.
  355.                        n7 source to: gnd.
  356.                    ).
  357.         | ).
  358.     | ).
  359.     examples* = ( |
  360.     | ).
  361. | )
  362.