Changeset 1155 for trunk/Modelica/Electrical
- Timestamp:
- 08/08/08 09:11:01 (4 months ago)
- Files:
-
- 1 modified
-
trunk/Modelica/Electrical/Digital.mo (modified) (85 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modelica/Electrical/Digital.mo
r1073 r1155 188 188 189 189 annotation ( 190 190 191 191 Documentation(info="<html> 192 192 <p> … … 216 216 </p> 217 217 <p><b>Code Table:</b></p> 218 218 219 219 <table border=1 cellspacing=0 cellpadding=2> 220 220 <tr><td valign=\"top\"><b>Logic value</b></td> … … 222 222 <td valign=\"top\"><b>Meaning</b></td> 223 223 </tr> 224 224 225 225 <tr><td valign=\"top\">'U'</td> <td valign=\"top\">1</td> <td valign=\"top\">Uninitialized</td></tr> 226 226 <tr><td valign=\"top\">'X'</td> <td valign=\"top\">2</td> <td valign=\"top\">Forcing Unknown</td></tr> … … 233 233 <tr><td valign=\"top\">'-'</td> <td valign=\"top\">9</td> <td valign=\"top\">Don't care</td></tr> 234 234 </table> 235 235 236 236 <p> 237 237 The library will be developed in two main steps. The first step contains the basic components and … … 239 239 the library is implemented and released for public use. 240 240 </p> 241 241 242 242 <p> 243 243 Copyright © 1998-2008, Modelica Association and Fraunhofer-Gesellschaft. … … 246 246 <i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified 247 247 under the terms of the <b>Modelica license</b>, see the license conditions 248 and the accompanying <b>disclaimer</b> 248 and the accompanying <b>disclaimer</b> 249 249 <a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i> 250 250 </p><br> 251 251 252 252 </HTML> 253 253 "), Diagram(coordinateSystem( … … 432 432 , 433 433 experiment(StopTime=250)); 434 D.Examples.Utilities.JKFF FF 434 D.Examples.Utilities.JKFF FF 435 435 annotation (Placement(transformation(extent={{-10,-40},{70, 436 436 40}}, rotation=0))); … … 489 489 <br> 490 490 <pre> <b>a</b> <b>b</b> <b>c</b> <b>s</b> <b>t</b></pre> 491 491 492 492 <pre> 1 0 1 0 1</pre> 493 493 <pre> 0 1 1 0 2</pre> 494 494 <pre> 1 1 0 1 3</pre> 495 495 <pre> 0 0 0 0 4</pre> 496 496 497 497 <br> 498 498 <br> … … 528 528 y0=3) annotation (Placement(transformation(extent={{-80,-38},{-60,-18}}, 529 529 rotation=0))); 530 Digital.Examples.Utilities.HalfAdder Adder(delayTime=0.3) 530 Digital.Examples.Utilities.HalfAdder Adder(delayTime=0.3) 531 531 annotation (Placement(transformation(extent={{-40, 532 532 -40},{40,40}}, rotation=0))); 533 Digital.Converters.LogicToReal s 533 Digital.Converters.LogicToReal s 534 534 annotation (Placement(transformation(extent={{60, 535 535 18},{80,38}}, rotation=0))); 536 Digital.Converters.LogicToReal c 536 Digital.Converters.LogicToReal c 537 537 annotation (Placement(transformation(extent={{60, 538 538 -38},{80,-18}}, rotation=0))); … … 566 566 <b>t</b> is the pick-up instant of the next bit(s) in the simulation. 567 567 <pre> <b>a</b>.y <b>b</b>.y <b>c</b>.y <b>c</b>out <b>h</b>.s <b>t</b> </pre> 568 568 569 569 <pre> 570 570 1 0 0 0 1 1 … … 599 599 Digital.Examples.Utilities.FullAdder Adder1 annotation (Placement( 600 600 transformation(extent={{0,-30},{60,30}}, rotation=0))); 601 Digital.Converters.LogicToReal s 601 Digital.Converters.LogicToReal s 602 602 annotation (Placement(transformation(extent={{70, 603 603 12},{90,32}}, rotation=0))); 604 Digital.Converters.LogicToReal c_out 604 Digital.Converters.LogicToReal c_out 605 605 annotation (Placement(transformation(extent= 606 606 {{70,-32},{90,-12}}, rotation=0))); 607 Digital.Examples.Utilities.Counter3 Counter 607 Digital.Examples.Utilities.Counter3 Counter 608 608 annotation (Placement(transformation(extent={{-60,-18},{-20,22}}, 609 609 rotation=0))); … … 613 613 -90,-22},{-70,-2}}, rotation=0))); 614 614 equation 615 connect(Adder1.s, s.x[1]) 615 connect(Adder1.s, s.x[1]) 616 616 annotation (Line(points={{60.3,21},{68,21},{68, 617 617 22},{75,22}}, color={127,0,127})); 618 connect(Adder1.c_out, c_out.x[1]) 618 connect(Adder1.c_out, c_out.x[1]) 619 619 annotation (Line(points={{60,-21},{68, 620 620 -21},{68,-22},{75,-22}}, color={127,0,127})); … … 650 650 b + 0 0 1 1 b + 1 0 1 0 651 651 <b>s 1 0 1 0 0</b> <b>s 0 0 0 1 1</b> 652 652 653 653 at t = 4 654 654 a 1 1 0 0 … … 667 667 </pre> 668 668 The simulation stop time has to be 5s. 669 669 670 670 </P> 671 671 </HTML> … … 726 726 t={1}) annotation (Placement(transformation(extent={{70,40},{110,80}}, 727 727 rotation=0))); 728 Sources.Set Set(x=3) 728 Sources.Set Set(x=3) 729 729 annotation (Placement(transformation( 730 730 origin={-150,-74}, 731 731 extent={{20,20},{-20,-20}}, 732 732 rotation=180))); 733 Digital.Examples.Utilities.FullAdder Adder1 733 Digital.Examples.Utilities.FullAdder Adder1 734 734 annotation (Placement(transformation(extent= 735 735 {{-100,-80},{-60,-40}}, rotation=0))); 736 Digital.Examples.Utilities.FullAdder Adder2 736 Digital.Examples.Utilities.FullAdder Adder2 737 737 annotation (Placement(transformation(extent={ 738 738 {-20,-80},{20,-40}}, rotation=0))); 739 Digital.Examples.Utilities.FullAdder Adder3 739 Digital.Examples.Utilities.FullAdder Adder3 740 740 annotation (Placement(transformation(extent={ 741 741 {60,-80},{100,-40}}, rotation=0))); 742 Digital.Examples.Utilities.FullAdder Adder4 742 Digital.Examples.Utilities.FullAdder Adder4 743 743 annotation (Placement(transformation(extent={ 744 744 {140,-80},{180,-40}}, rotation=0))); … … 786 786 annotation ( 787 787 Documentation(info="<HTML> 788 788 789 789 </HTML> 790 790 "), Icon(coordinateSystem( … … 807 807 D.Sources.Clock Clock annotation (Placement(transformation(extent={ 808 808 {-90,-48},{-50,-8}}, rotation=0))); 809 D.Examples.Utilities.Counter3 Counter 809 D.Examples.Utilities.Counter3 Counter 810 810 annotation (Placement(transformation(extent={{-30,-40},{50,40}}, 811 811 rotation=0))); … … 823 823 annotation ( 824 824 Documentation(info="<HTML> 825 825 826 826 </HTML> 827 827 "), Icon(coordinateSystem( … … 844 844 D.Sources.Clock Clock annotation (Placement(transformation(extent={ 845 845 {-90,-48},{-50,-8}}, rotation=0))); 846 D.Examples.Utilities.Counter Counter(n=4) 846 D.Examples.Utilities.Counter Counter(n=4) 847 847 annotation (Placement(transformation(extent={{-30,-40},{50,40}}, 848 848 rotation=0))); … … 1125 1125 D.Interfaces.DigitalOutput qn annotation (Placement(transformation( 1126 1126 extent={{90,-80},{110,-60}}, rotation=0))); 1127 D.Delay.TransportDelay TD1(delayTime=delayTime,y0=q0) 1127 D.Delay.TransportDelay TD1(delayTime=delayTime,y0=q0) 1128 1128 annotation (Placement(transformation(extent={{-60,-64},{-40,-44}}, 1129 1129 rotation=0))); … … 1220 1220 D.Interfaces.DigitalOutput q annotation (Placement(transformation(extent= 1221 1221 {{90,60},{110,80}}, rotation=0))); 1222 D.Interfaces.DigitalOutput qn "not Q" 1222 D.Interfaces.DigitalOutput qn "not Q" 1223 1223 annotation (Placement(transformation(extent={{90,-80},{110,-60}}, 1224 1224 rotation=0))); 1225 1225 D.Interfaces.DigitalInput clk annotation (Placement(transformation( 1226 1226 extent={{-110,-10},{-90,10}}, rotation=0))); 1227 D.Examples.Utilities.RS RS1(delayTime=delayTime,q0=q0) 1227 D.Examples.Utilities.RS RS1(delayTime=delayTime,q0=q0) 1228 1228 annotation (Placement(transformation( 1229 1229 extent={{-10,-40},{70,40}}, rotation=0))); … … 1233 1233 -48},{-30,-8}}, rotation=0))); 1234 1234 equation 1235 connect(And2.y, RS1.r) 1235 connect(And2.y, RS1.r) 1236 1236 annotation (Line( 1237 1237 points={{-30,-28},{-10,-28}}, 1238 1238 color={127,0,127})); 1239 connect(And1.y, RS1.s) 1239 connect(And1.y, RS1.s) 1240 1240 annotation (Line( 1241 1241 points={{-30,28},{-10,28}}, … … 1321 1321 parameter Modelica.SIunits.Time Tdel=0.01 "delay time"; 1322 1322 parameter Digital.Interfaces.Logic QInit=L.'U' "initial value"; 1323 Digital.Interfaces.DigitalInput d 1323 Digital.Interfaces.DigitalInput d 1324 1324 annotation (Placement(transformation(extent= 1325 1325 {{-110,60},{-90,80}}, rotation=0))); 1326 Digital.Interfaces.DigitalOutput q 1326 Digital.Interfaces.DigitalOutput q 1327 1327 annotation (Placement(transformation(extent= 1328 1328 {{90,60},{110,80}}, rotation=0))); 1329 Digital.Interfaces.DigitalOutput qn "not Q" 1329 Digital.Interfaces.DigitalOutput qn "not Q" 1330 1330 annotation (Placement(transformation(extent={{90,-80},{110,-60}}, 1331 1331 rotation=0))); … … 1334 1334 D.Examples.Utilities.RSFF RSFF1 annotation (Placement(transformation( 1335 1335 extent={{-10,-40},{70,40}}, rotation=0))); 1336 Digital.Basic.Not Not1 1336 Digital.Basic.Not Not1 1337 1337 annotation (Placement(transformation(extent={{-70, 1338 1338 -48},{-30,-8}}, rotation=0))); 1339 1339 equation 1340 connect(RSFF1.q,q) 1340 connect(RSFF1.q,q) 1341 1341 annotation (Line( 1342 1342 points={{70,28},{80,28},{80,70},{100,70}}, 1343 1343 color={127,0,127})); 1344 connect(RSFF1.qn,qn) 1344 connect(RSFF1.qn,qn) 1345 1345 annotation (Line( 1346 1346 points={{70,-28},{80,-28},{80,-70},{100,-70}}, 1347 1347 color={127,0,127})); 1348 connect(Not1.y, RSFF1.r) 1348 connect(Not1.y, RSFF1.r) 1349 1349 annotation (Line( 1350 1350 points={{-30,-28},{-10,-28}}, … … 1432 1432 D.Interfaces.DigitalOutput q annotation (Placement(transformation(extent= 1433 1433 {{90,60},{110,80}}, rotation=0))); 1434 D.Interfaces.DigitalOutput qn "not Q" 1434 D.Interfaces.DigitalOutput qn "not Q" 1435 1435 annotation (Placement(transformation(extent={{90,-80},{110,-60}}, 1436 1436 rotation=0))); … … 1439 1439 D.Interfaces.DigitalInput k annotation (Placement(transformation(extent= 1440 1440 {{-110,-80},{-90,-60}}, rotation=0))); 1441 D.Examples.Utilities.RS RS1(delayTime=delayTime,q0=q0) 1441 D.Examples.Utilities.RS RS1(delayTime=delayTime,q0=q0) 1442 1442 annotation (Placement(transformation( 1443 1443 extent={{30,-24},{70,16}}, rotation=0))); 1444 D.Examples.Utilities.RS RS2(delayTime=delayTime,q0=q0) 1444 D.Examples.Utilities.RS RS2(delayTime=delayTime,q0=q0) 1445 1445 annotation (Placement(transformation( 1446 1446 extent={{-44,-20},{-4,20}}, rotation=0))); … … 1494 1494 model HalfAdder "half adder" 1495 1495 parameter Real delayTime=0 "delay time"; 1496 Digital.Interfaces.DigitalInput b 1496 Digital.Interfaces.DigitalInput b 1497 1497 annotation (Placement(transformation(extent={{-110,-80},{-90, 1498 1498 -60}}, rotation=0))); 1499 Digital.Interfaces.DigitalOutput s 1499 Digital.Interfaces.DigitalOutput s 1500 1500 annotation (Placement(transformation( 1501 1501 extent={{90,60},{110,80}}, rotation=0))); … … 1545 1545 thickness=0.5)}), 1546 1546 Documentation(info="<html> 1547 1547 1548 1548 </html>")); 1549 Digital.Interfaces.DigitalInput a 1549 Digital.Interfaces.DigitalInput a 1550 1550 annotation (Placement(transformation(extent={{-110,60},{-90, 1551 1551 80}}, rotation=0))); 1552 Digital.Interfaces.DigitalOutput c 1552 Digital.Interfaces.DigitalOutput c 1553 1553 annotation (Placement(transformation( 1554 1554 extent={{90,-80},{110,-60}}, rotation=0))); 1555 Gates.AndGate AND(tLH=delayTime, tHL=delayTime) 1555 Gates.AndGate AND(tLH=delayTime, tHL=delayTime) 1556 1556 annotation (Placement(transformation(extent={{-20,-82},{20, 1557 1557 -42}}, rotation=0))); 1558 Gates.XorGate XOR(tLH=delayTime, tHL=delayTime) 1558 Gates.XorGate XOR(tLH=delayTime, tHL=delayTime) 1559 1559 annotation (Placement(transformation(extent={{-20,42},{20,82}}, 1560 1560 rotation=0))); 1561 1561 1562 1562 equation 1563 connect(AND.y, c) 1563 connect(AND.y, c) 1564 1564 annotation (Line( 1565 1565 points={{20,-62},{60,-62},{60,-70},{100,-70}}, 1566 1566 color={127,0,127})); 1567 connect(XOR.y, s) 1567 connect(XOR.y, s) 1568 1568 annotation (Line( 1569 1569 points={{20,62},{60,62},{60,70},{100,70}}, 1570 1570 color={127,0,127})); 1571 connect(b, AND.x[1]) 1571 connect(b, AND.x[1]) 1572 1572 annotation (Line( 1573 1573 points={{-100,-70},{-12,-70}}, 1574 1574 color={127,0,127})); 1575 connect(b, XOR.x[1]) 1575 connect(b, XOR.x[1]) 1576 1576 annotation (Line( 1577 1577 points={{-100,-70},{-30,-70},{-30,54},{-12,54}}, 1578 1578 color={127,0,127})); 1579 connect(a, XOR.x[2]) 1579 connect(a, XOR.x[2]) 1580 1580 annotation (Line( 1581 1581 points={{-100,70},{-12,70}}, 1582 1582 color={127,0,127})); 1583 connect(a, AND.x[2]) 1583 connect(a, AND.x[2]) 1584 1584 annotation (Line( 1585 1585 points={{-100,70},{-40,70},{-40,-54},{-12,-54}}, … … 1594 1594 <pre> 1595 1595 <b>a b c in c out s</b> 1596 1596 1597 1597 1 1 1 0 1598 1598 0 0 0 0 … … 1600 1600 0 1 0 1 1601 1601 </pre> 1602 1603 1602 1603 1604 1604 </P> 1605 1605 </HTML> … … 1671 1671 ); 1672 1672 1673 HalfAdder Adder2(delayTime=0.001) 1673 HalfAdder Adder2(delayTime=0.001) 1674 1674 annotation (Placement(transformation( 1675 1675 extent={{10,36},{50,76}}, rotation=0))); 1676 HalfAdder Adder1(delayTime=0.001) 1676 HalfAdder Adder1(delayTime=0.001) 1677 1677 annotation (Placement(transformation( 1678 1678 extent={{-60,36},{-20,76}}, rotation=0))); 1679 Digital.Interfaces.DigitalInput a 1679 Digital.Interfaces.DigitalInput a 1680 1680 annotation (Placement(transformation( 1681 1681 origin={-100,70}, 1682 1682 extent={{-10,-10},{10,10}}, 1683 1683 rotation=180))); 1684 Digital.Interfaces.DigitalInput b 1684 Digital.Interfaces.DigitalInput b 1685 1685 annotation (Placement(transformation( 1686 1686 origin={-100,30}, 1687 1687 extent={{-10,-10},{10,10}}, 1688 1688 rotation=180))); 1689 Digital.Interfaces.DigitalInput c_in 1689 Digital.Interfaces.DigitalInput c_in 1690 1690 annotation (Placement(transformation( 1691 1691 origin={-100,-70}, 1692 1692 extent={{-10,-10},{10,10}}, 1693 1693 rotation=180))); 1694 Digital.Interfaces.DigitalOutput s 1694 Digital.Interfaces.DigitalOutput s 1695 1695 annotation (Placement(transformation( 1696 1696 origin={101,70}, 1697 1697 extent={{11,-10},{-11,10}}, 1698 1698 rotation=180))); 1699 Digital.Interfaces.DigitalOutput c_out 1699 Digital.Interfaces.DigitalOutput c_out 1700 1700 annotation (Placement(transformation( 1701 1701 origin={100,-70}, … … 1709 1709 points={{100,-70},{50,-70}}, 1710 1710 color={127,0,127})); 1711 connect(Adder2.c, OR.x[2]) 1711 connect(Adder2.c, OR.x[2]) 1712 1712 annotation (Line( 1713 1713 points={{50,42},{70,42},{70,-40},{10,-40},{10,-62},{18,-62}}, 1714 1714 color={127,0,127})); 1715 connect(Adder2.s, s) 1715 connect(Adder2.s, s) 1716 1716 annotation (Line(points={{50,70},{101,70}}, color={127,0,127})); 1717 1717 connect(Adder1.a, a) annotation (Line(points={{-60,70},{-100,70}}, … … 1731 1731 annotation ( 1732 1732 Documentation(info="<HTML> 1733 1733 1734 1734 </HTML> 1735 1735 "), Icon(coordinateSystem( … … 1794 1794 ); 1795 1795 parameter Integer n=2 "number of single adders"; 1796 Digital.Examples.Utilities.FullAdder Adder[n] 1796 Digital.Examples.Utilities.FullAdder Adder[n] 1797 1797 annotation (Placement(transformation(extent= 1798 1798 {{-20,-20},{20,20}}, rotation=0))); … … 1825 1825 annotation ( 1826 1826 Documentation(info="<HTML> 1827 1827 1828 1828 </HTML> 1829 1829 "), Diagram(graphics), … … 1881 1881 fillPattern=FillPattern.Solid, 1882 1882 textString="Q1")})); 1883 D.Interfaces.DigitalInput enable 1883 D.Interfaces.DigitalInput enable 1884 1884 annotation (Placement(transformation( 1885 1885 extent={{-110,60},{-90,80}}, rotation=0))); 1886 1886 D.Interfaces.DigitalOutput q2 annotation (Placement(transformation(extent= 1887 1887 {{90,60},{110,80}}, rotation=0))); 1888 D.Interfaces.DigitalInput count 1888 D.Interfaces.DigitalInput count 1889 1889 annotation (Placement(transformation( 1890 1890 extent={{-110,-80},{-90,-60}}, rotation=0))); 1891 D.Examples.Utilities.JKFF FF1 1891 D.Examples.Utilities.JKFF FF1 1892 1892 annotation (Placement(transformation(extent={{-74,-20},{-34,20}}, 1893 1893 rotation=0))); 1894 D.Examples.Utilities.JKFF FF2 1894 D.Examples.Utilities.JKFF FF2 1895 1895 annotation (Placement(transformation(extent={{-20,-20},{20,20}}, 1896 1896 rotation=0))); 1897 D.Examples.Utilities.JKFF FF3 1897 D.Examples.Utilities.JKFF FF3 1898 1898 annotation (Placement(transformation(extent={{34,-20},{74,20}}, 1899 1899 rotation=0))); … … 1954 1954 annotation ( 1955 1955 Documentation(info="<HTML> 1956 1956 1957 1957 </HTML> 1958 1958 "), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, … … 2009 2009 parameter Modelica.SIunits.Time delayTime=0.001 "delay of each JKFF"; 2010 2010 parameter D.Interfaces.Logic q0=L.'0' "initial value"; 2011 D.Interfaces.DigitalInput enable 2011 D.Interfaces.DigitalInput enable 2012 2012 annotation (Placement(transformation(extent= 2013 2013 {{-110,60},{-90,80}}, rotation=0))); 2014 D.Interfaces.DigitalInput count 2014 D.Interfaces.DigitalInput count 2015 2015 annotation (Placement(transformation(extent= 2016 2016 {{-110,-80},{-90,-60}}, rotation=0))); … … 2034 2034 This package contains utility components used by package Examples. 2035 2035 </p> 2036 2036 2037 2037 </html>")); 2038 2038 end Utilities; … … 2082 2082 'H' "H Weak 1", 2083 2083 '-' "- Don't care") 2084 "Logic values and their coding according to IEEE 1164 STD_ULOGIC type" 2084 "Logic values and their coding according to IEEE 1164 STD_ULOGIC type" 2085 2085 annotation (Documentation(info="<html> 2086 2086 <p><b>Code Table:</b></p> 2087 2087 2088 2088 <table border=1 cellspacing=0 cellpadding=2> 2089 2089 <tr><td valign=\"top\"><b>Logic value</b></td> 2090 2090 <td valign=\"top\"><b>Meaning</b></td> 2091 2091 </tr> 2092 2092 2093 2093 <tr><td valign=\"top\">'U'</td> <td valign=\"top\">Uninitialized</td></tr> 2094 2094 <tr><td valign=\"top\">'X'</td> <td valign=\"top\">Forcing Unknown</td></tr> … … 2101 2101 <tr><td valign=\"top\">'-'</td> <td valign=\"top\">Don't care</td></tr> 2102 2102 </table> 2103 2104 2103 2104 2105 2105 </html>")); 2106 2106 … … 2113 2113 graphics), 2114 2114 Documentation(info="<html> 2115 2115 2116 2116 </html>")); 2117 2117 2118 2118 connector DigitalInput = input DigitalSignal 2119 "input DigitalSignal as connector" 2119 "input DigitalSignal as connector" 2120 2120 annotation (defaultComponentName="x", 2121 2121 Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ … … 2137 2137 fillPattern=FillPattern.Solid)}), 2138 2138 Documentation(info="<html> 2139 2139
