coriolis/stratus1/doc/patterns/latex/patterns/node16.html

103 lines
2.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 2012 (1.2)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Example</TITLE>
<META NAME="description" CONTENT="Example">
<META NAME="keywords" CONTENT="patterns">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="LaTeX2HTML v2012">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="SoC.css">
<LINK REL="next" HREF="node17.html">
<LINK REL="previous" HREF="node5.html">
<LINK REL="up" HREF="patterns.html">
<LINK REL="next" HREF="node17.html">
</HEAD>
<BODY >
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr><td class="navigation" align="left" width="33%"><B>Previous</B></td>
<td class="navigation" align="center" width="34%"><B>Up</B></td>
<td class="navigation" align="right" width="33%"><B>Next</B></td>
</tr><tr>
<td class="navigation" align="left" width="33%"><A HREF="node15.html">pattern_end</A></td>
<td class="navigation" align="center" width="34%"><A HREF="patterns.html">Patterns Module User's Manual</A></td>
<td class="navigation" align="right" width="33%"><A HREF="node17.html">About this document ...</A></td>
</tr></table>
<hr>
<br>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00040000000000000000">
Example</A>
</H1>
<code>Pattern</code> method for an addaccu
<PRE>
def Pattern(self):
# initialisation
pat = PatWrite(self._name+'.pat',self)
# declaration of ports
pat.declar(self.ck, 'B')
pat.declar(self.load, 'B')
pat.declar(self.input, 'X')
pat.declar(self.output, 'X')
pat.declar(self.vdd, 'B')
pat.declar(self.vss, 'B')
# use of pat.declar_interface(self) has the same effect
# description beginning
pat.pattern_begin()
# affect vdd and vss values
pat.affect_int(self.vdd,1)
pat.affect_int(self.vss,0)
# first pattern : load an initial value
pat.affect_int(self.input,5)
pat.affect_int(self.load,1)
pat.affect_int(self.ck,0)
# add the pattern in the pattern file
pat.addpat()
# compute next event
pat.affect_int(self.ck,1)
pat.addpat()
# compute 22 cycle of accumulation
pat.affect_int(self.load,0)
for i in range(1,22):
pat.affect_int(self.ck,0)
pat.addpat()
pat.affect_int(self.ck,1)
pat.affect_int(self.output,i+5)
pat.addpat()
# end of the description
pat.pattern_end()
</PRE>
<P>
<BR> <HR>
<ADDRESS>
Sophie B<small>ELLOEIL</small><br>20051116.1
</ADDRESS>
</BODY>
</HTML>