1 |
6 |
root |
<html>
|
2 |
|
|
|
3 |
|
|
<head>
|
4 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
5 |
|
|
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
|
6 |
|
|
<meta name="ProgId" content="FrontPage.Editor.Document">
|
7 |
|
|
<title>4-bit Counter</title>
|
8 |
|
|
</head>
|
9 |
|
|
|
10 |
|
|
<body bgcolor="#99CCFF">
|
11 |
|
|
|
12 |
|
|
<p class="MsoNormal"><font size="4"><b>.c file of 4-bit counter</b></font></p>
|
13 |
|
|
<p class="MsoNormal"> </p>
|
14 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">#include <genlib.h></p>
|
15 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
16 |
|
|
</o:p>
|
17 |
|
|
</p>
|
18 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">main()</p>
|
19 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">{</p>
|
20 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
21 |
|
|
</span>DEF_LOFIG("counter");</p>
|
22 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes"> </span></p>
|
23 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
24 |
|
|
</span>LOCON("E",<span style="mso-spacerun: yes">
|
25 |
|
|
</span>IN, "E");</p>
|
26 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
27 |
|
|
</span>LOCON("ck",<span style="mso-spacerun: yes">
|
28 |
|
|
</span>IN, "ck");</p>
|
29 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
30 |
|
|
</span>LOCON("res",<span style="mso-spacerun: yes">
|
31 |
|
|
</span>IN, "res");</p>
|
32 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
33 |
|
|
</span>LOCON("vdd",<span style="mso-spacerun: yes">
|
34 |
|
|
</span>IN, "vdd");</p>
|
35 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
36 |
|
|
</span>LOCON("vss",<span style="mso-spacerun: yes">
|
37 |
|
|
</span>IN, "vss");</p>
|
38 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
39 |
|
|
</span>LOCON("A[0:3]",<span style="mso-spacerun: yes">
|
40 |
|
|
</span>INOUT, "A[0:3]");</p>
|
41 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
42 |
|
|
</span>LOCON("q_c",<span style="mso-spacerun: yes">
|
43 |
|
|
</span>OUT, "q_c");</p>
|
44 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
45 |
|
|
</o:p>
|
46 |
|
|
</p>
|
47 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("a2_y","an00",
|
48 |
|
|
"E","A[0]", "c_1", "vdd" ,"vss",0);</p>
|
49 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("a2_y","an01",
|
50 |
|
|
"c_1","A[1]", "c_2", "vdd" ,"vss",0);</p>
|
51 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("a2_y","an02",
|
52 |
|
|
"c_2","A[2]", "c_3", "vdd" ,"vss",0);</p>
|
53 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("a2_y","an03",
|
54 |
|
|
"c_3","A[3]", "q_c", "vdd" ,"vss",0);</p>
|
55 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
56 |
|
|
</o:p>
|
57 |
|
|
</p>
|
58 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("xr2_y","xr00",
|
59 |
|
|
"E","A[0]", "d_1", "vdd" ,"vss",0);</p>
|
60 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("xr2_y","xr01",
|
61 |
|
|
"c_1","A[1]", "d_2", "vdd" ,"vss",0);</p>
|
62 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("xr2_y","xr02",
|
63 |
|
|
"c_2","A[2]", "d_3", "vdd" ,"vss",0);</p>
|
64 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("xr2_y","xr03",
|
65 |
|
|
"c_3","A[3]", "d_4", "vdd" ,"vss",0);</p>
|
66 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
67 |
|
|
</o:p>
|
68 |
|
|
</p>
|
69 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
70 |
|
|
</o:p>
|
71 |
|
|
</p>
|
72 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("dffres",
|
73 |
|
|
"dff0", "d_1", "ck","res","A[0]","vdd","vss",0);</p>
|
74 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("dffres",
|
75 |
|
|
"dff1", "d_2", "ck","res","A[1]","vdd","vss",0);</p>
|
76 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("dffres",
|
77 |
|
|
"dff2", "d_3", "ck","res","A[2]","vdd","vss",0);</p>
|
78 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">LOINS("dffres",
|
79 |
|
|
"dff3", "d_4", "ck","res","A[3]","vdd","vss",0);</p>
|
80 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
81 |
|
|
</o:p>
|
82 |
|
|
</p>
|
83 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"> <o:p>
|
84 |
|
|
</o:p>
|
85 |
|
|
</p>
|
86 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
87 |
|
|
</span>SAVE_LOFIG();</p>
|
88 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0"><span style="mso-spacerun: yes">
|
89 |
|
|
</span>exit(0);</p>
|
90 |
|
|
<p class="MsoNormal" style="margin-top: 0; margin-bottom: 0">}</p>
|
91 |
|
|
|
92 |
|
|
</body>
|
93 |
|
|
|
94 |
|
|
</html>
|