From 1ffea26b4857f3d4b6de5bc8e736b7a34599718a Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 6 Apr 2012 12:43:36 +0200 Subject: Add class GenericAlgorithms Signed-off-by: Michael Buesch --- README-DEVELOPERS.lyx | 57 ++++- README-DEVELOPERS.ps | 416 +++++++++++++++++++------------------ libtoprammer/chip.py | 16 +- libtoprammer/chip_at27c256r.py | 44 +--- libtoprammer/chip_generic_sram.py | 5 +- libtoprammer/generic_algorithms.py | 143 +++++++++++++ 6 files changed, 419 insertions(+), 262 deletions(-) create mode 100644 libtoprammer/generic_algorithms.py diff --git a/README-DEVELOPERS.lyx b/README-DEVELOPERS.lyx index 8786b24..06f2090 100644 --- a/README-DEVELOPERS.lyx +++ b/README-DEVELOPERS.lyx @@ -1,42 +1,60 @@ -#LyX 1.6.7 created this file. For more info see http://www.lyx.org/ -\lyxformat 345 +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 \begin_document \begin_header \textclass article \use_default_options false +\maintain_unincluded_children false \language english +\language_package default \inputencoding auto +\fontencoding global \font_roman default \font_sans default \font_typewriter default \font_default_family default +\use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default \paperfontsize default \use_hyperref false \papersize default \use_geometry false \use_amsmath 1 \use_esint 1 +\use_mhchem 1 +\use_mathdots 1 \cite_engine basic \use_bibtopic false +\use_indices false \paperorientation portrait +\suppress_date false +\use_refstyle 0 +\index Index +\shortcut idx +\color #008000 +\end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent -\defskip medskip +\paragraph_indentation default \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false -\author "" -\author "" +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false \end_header \begin_body @@ -497,8 +515,8 @@ erase() Erase the DUT. \begin_layout Description test() Run an optional unit-test on the chip. - The convenience wrapper genericTest(self, readFunc, writeFunc, size) may - be used to implement this method. + The generic algorithm GenericAlgorithms.simpleTest may be used to implement + this method. \end_layout \begin_layout Description @@ -595,6 +613,31 @@ The chip class (_not_ an instance of it) is passed as first parameter. See the inline sourcecode documentation for details. \end_layout +\begin_layout Subsection +Generic top-half algorithms +\end_layout + +\begin_layout Standard +The Python class +\begin_inset Quotes eld +\end_inset + +GenericAlgorithms +\begin_inset Quotes erd +\end_inset + + in the generic_algorithms.py file provides several generic chip access algorithm +s that can be used in the +\begin_inset Quotes eld +\end_inset + +Chip +\begin_inset Quotes erd +\end_inset + + methods. +\end_layout + \begin_layout Subsection FPGA bottom-half implementation \end_layout diff --git a/README-DEVELOPERS.ps b/README-DEVELOPERS.ps index b8ae4dd..f9e4920 100644 --- a/README-DEVELOPERS.ps +++ b/README-DEVELOPERS.ps @@ -1,17 +1,17 @@ %!PS-Adobe-2.0 -%%Creator: dvips(k) 5.98 Copyright 2009 Radical Eye Software +%%Creator: dvips(k) 5.991 Copyright 2011 Radical Eye Software %%Title: README-DEVELOPERS.dvi -%%CreationDate: Tue Jan 18 17:15:15 2011 +%%CreationDate: Fri Apr 6 12:42:13 2012 %%Pages: 7 %%PageOrder: Ascend -%%BoundingBox: 0 0 596 842 +%%BoundingBox: 0 0 612 792 %%DocumentFonts: CMSY10 -%%DocumentPaperSizes: a4 +%%DocumentPaperSizes: Letter %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o README-DEVELOPERS.ps README-DEVELOPERS.dvi %DVIPSParameters: dpi=600 -%DVIPSSource: TeX output 2011.01.18:1715 +%DVIPSSource: TeX output 2012.04.06:1241 %%BeginProcSet: tex.pro 0 0 %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S @@ -43,19 +43,21 @@ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N -/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ -/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) -(LaserWriter 16/600)]{A length product length le{A length product exch 0 -exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse -end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask -grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} -imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round -exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto -fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p -delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} -B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ -p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S -rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end +/dir 0 def/dyy{/dir 0 def}B/dyt{/dir 1 def}B/dty{/dir 2 def}B/dtt{/dir 3 +def}B/p{dir 2 eq{-90 rotate show 90 rotate}{dir 3 eq{-90 rotate show 90 +rotate}{show}ifelse}ifelse}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 +N/Ry 0 N/V{}B/RV/v{/Ry X/Rx X V}B statusdict begin/product where{pop +false[(Display)(NeXT)(LaserWriter 16/600)]{A length product length le{A +length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse} +forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{ +BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat +{BDot}imagemask grestore}}ifelse B/QV{gsave newpath transform round exch +round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 +rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B +/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M} +B/g{0 M}B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p +-3 w}B/n{p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{ +0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: texps.pro 0 0 @@ -315,7 +317,7 @@ F08A7F7C5F36FEE9F5D450D19F72C09580DDE2B3747D8A1054981BAEF31D6C42 cleartomark {restore}if %%EndFont -TeXDict begin 39158280 55380996 1000 600 600 (README-DEVELOPERS.dvi) +TeXDict begin 40258431 52099146 1000 600 600 (README-DEVELOPERS.dvi) @start %DVIPSBitmapFont: Fa ectt1000 10 35 /Fa 35 122 df<007000001C01F800007E03F80000FE07F80001FE0FF00003FC1FC00007 @@ -3002,8 +3004,8 @@ F80000000000003FF00000000000003FF00000000000001FE00000000000001FE0000000 000000000FFFF0000000000003FFC0000000000000FE0000000000003E4D7DB445>121 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fg ecrm1200 12 11 -/Fg 11 122 df<1E007F80FF80FFC0FFC0FFE0FFE0FFE07FE01E60006000600060006000 +%DVIPSBitmapFont: Fg ecrm1200 12 10 +/Fg 10 115 df<1E007F80FF80FFC0FFC0FFE0FFE0FFE07FE01E60006000600060006000 E000C000C000C001C0018003800300070006000E001C003800700060000B1D78891B>44 D<0000FF00000007FFE000001F81F800003E007C0000FC003F0001F8001F8001F0000F80 03E00007C007C00003E007C00003E00FC00003F00F800001F01F800001F81F800001F83F @@ -3031,67 +3033,63 @@ FFC00003FC7F800007FC3F000007FC00000007FC00000007F800000007F80000000FF800 800000003F000000007C00000000F800000000F000000001E000000003C0000000078000 00000F00000C001E00000C003C00000C0038000018007000001800E000001801C0000018 038000003807000000300E000000701FFFFFFFF01FFFFFFFF03FFFFFFFF07FFFFFFFF0FF -FFFFFFE0FFFFFFFFE0FFFFFFFFE026427BC131>I<0000FF00000007FFE000001FFFF800 -007F00FE0000FC003F0001F0001F8003E0000FC003C00007E007C00003F00F800001F00F -800001F00F000001F81F000000F81F000000F81F000000F81F000000F81F800000F81F80 -0000F81FC00001F81FC00001F01FE00001F00FF00003E00FFC0003E007FE0007C007FF80 -0F8003FFC01F0001FFF03E0001FFF87800007FFEF000003FFFC000001FFFC0000007FFE0 -000003FFF8000007FFFC00001E7FFF00007C1FFF8000F80FFFC001E003FFE003C001FFF0 -07C0007FF80F80003FFC1F00000FFC3E000007FE3E000001FE7C000000FE7C000000FF7C -0000007FF80000003FF80000003FF80000001FF80000001FF80000001FF80000001FF800 -00001FFC0000001E7C0000003E7C0000003E7E0000003C3E0000007C1F000000F81F8000 -01F00FC00003E007E00007C003F8001F8000FF00FF00003FFFFC00000FFFF0000001FF80 -0028447CC131>56 D<000FFFFFFE000FFFFFFE000FFFFFFE000003FF80000001FF000000 -00FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000 -FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF -00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF00 -000000FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF0000 -0000FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF000000 -00FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000FF00000000 -FF00000000FF00000000FF00000000FF003F0000FF007F8000FF00FFC000FF00FFC000FF -00FFC000FF00FFC000FF00FFC001FE00FF8001FE00FF0001FE006C0003FC00700003F800 -380007F8001C0007F0000E000FE00007001F800003E07F000000FFFC0000001FE0000027 -467BC332>74 D<0007FC000000003FFF80000000F80FE0000003C003F00000070001F800 -000E0000FC00000FC0007E00001FE0007F00001FF0003F80001FF0003F80001FF0003F80 -001FF0001FC0001FF0001FC0000FE0001FC0000380001FC0000000001FC0000000001FC0 -000000001FC0000000001FC00000000FFFC0000001FFFFC000000FFE1FC000003FC01FC0 -0000FF001FC00003FC001FC00007F8001FC0000FF0001FC0001FE0001FC0003FC0001FC0 -007FC0001FC0007F80001FC0007F80001FC060FF00001FC060FF00001FC060FF00001FC0 -60FF00003FC060FF00003FC060FF00003FC060FF80007FC0607F8000EFC0607FC000C7E0 -C03FC001C7E0C01FE00783F1C007F81E03FF8001FFFC01FF00001FE0007C002B2E7CAC31 ->97 D<01FC01FE0000FFFC07FFC000FFFC1E07F000FFFC3801F80007FC7001FC0003FCE0 -00FC0001FDC000FE0001FD8000FE0001FF80007F0001FF00007F0001FF00007F0001FE00 -007F0001FE00007F0001FE00007F0001FC00007F0001FC00007F0001FC00007F0001FC00 -007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00 -007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00 -007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00 -007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0003FE0000FF80FFFFF8 -3FFFFEFFFFF83FFFFEFFFFF83FFFFE2F2C7DAB36>110 D<03F803F0FFF81FFCFFF83C3E -FFF8707F07F8E0FF03F9C0FF01F980FF01FB80FF01FB007E01FB003C01FF000001FE0000 -01FE000001FE000001FE000001FC000001FC000001FC000001FC000001FC000001FC0000 -01FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC0000 -01FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC0000 -01FC000003FF0000FFFFFE00FFFFFE00FFFFFE00202C7DAB26>114 -D<01FC00007F00FFFC003FFF00FFFC003FFF00FFFC003FFF0007FC0001FF0003FC0000FF -0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F -0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F -0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F -0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F0001FC00007F -0001FC00007F0001FC00007F0001FC0000FF0001FC0000FF0001FC0000FF0001FC0001FF -0001FC0001FF0000FC0001FF0000FE0003FF00007E00077F80007F000E7FC0003F001C7F -FE000FC0787FFE0003FFF07FFE00007F807F002F2D7DAB36>117 -D121 -D E +FFFFFFE0FFFFFFFFE0FFFFFFFFE026427BC131>I<000007FC0000003FFF000000FFFFC0 +0003FC03E00007E000F0001FC00038003F000058007E0001FC00FE0003FC00FC0007FC01 +F80007FC03F00007FC03F00007FC07E00003F80FE00001F00FE00000001FC00000001FC0 +0000001FC00000003F800000003F800000003F800000007F800000007F800000007F007F +80007F01FFF0007F0780FC00FF0E003E00FF1C001F80FF38000FC0FF700007E0FF600007 +E0FFE00003F0FFC00003F8FFC00001F8FFC00001FCFF800001FCFF800000FEFF800000FE +FF800000FEFF000000FFFF000000FFFF000000FFFF000000FF7F000000FF7F000000FF7F +000000FF7F000000FF7F000000FF7F800000FF3F800000FF3F800000FF3F800000FE1F80 +0000FE1F800001FE1FC00001FC0FC00001FC0FC00003F807E00003F807E00007F003F000 +07E001F8000FC000FC001F80007E003F00003F80FE00000FFFF8000003FFE0000000FF80 +0028447CC131>54 D<00000000C00000000000000001E00000000000000001E000000000 +00000001E00000000000000003F00000000000000003F00000000000000003F000000000 +00000007F80000000000000007F80000000000000007F8000000000000000FFC00000000 +0000000FFC000000000000000FFC0000000000000019FE0000000000000019FE00000000 +00000019FE0000000000000030FF0000000000000030FF0000000000000070FF80000000 +000000607F80000000000000607F80000000000000E07FC0000000000000C03FC0000000 +000000C03FC0000000000001C03FE0000000000001801FE0000000000001801FE0000000 +000003001FF0000000000003000FF0000000000003000FF0000000000006000FF8000000 +0000060007F80000000000060007F800000000000C0003FC00000000000C0003FC000000 +00000C0003FC0000000000180001FE0000000000180001FE0000000000180001FE000000 +0000300000FF0000000000300000FF0000000000700000FF80000000006000007F800000 +00006000007F8000000000E000007FC000000000FFFFFFFFC000000000FFFFFFFFC00000 +0001FFFFFFFFE0000000018000001FE0000000018000001FE0000000030000001FF00000 +00030000000FF0000000030000000FF0000000060000000FF80000000600000007F80000 +000600000007F80000000C00000003FC0000000C00000003FC0000000C00000003FC0000 +001800000001FE0000001800000001FE0000001800000001FE0000003000000000FF0000 +003000000000FF0000007800000000FF800000F800000000FF800001FC00000000FFC000 +0FFF00000003FFE000FFFFE000007FFFFFC0FFFFE000007FFFFFC0FFFFE000007FFFFFC0 +42477DC649>65 D<01E00007F80007F8000FFC000FFC000FFC000FFC0007F80007F80001 +E00000000000000000000000000000000000000000000000000000000000000000000000 +000000000001FC00FFFC00FFFC00FFFC0007FC0003FC0001FC0001FC0001FC0001FC0001 +FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001 +FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001 +FC0001FC0001FC0001FC0001FC0001FC0003FE00FFFFF8FFFFF8FFFFF815437DC21C> +105 D<01FC00FFFC00FFFC00FFFC0007FC0003FC0001FC0001FC0001FC0001FC0001FC00 +01FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC00 +01FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC00 +01FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC00 +01FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC0001FC00 +01FC0001FC0001FC0001FC0001FC0001FC0003FE00FFFFF8FFFFF8FFFFF815457DC41C> +108 D<01FC03FC0000FFFC0FFF8000FFFC3C07E000FFFC7001F80007FDE000FE0001FD80 +007F0001FF80003F8001FF00001FC001FE00001FE001FC00000FE001FC00000FF001FC00 +0007F001FC000007F801FC000003F801FC000003FC01FC000003FC01FC000003FC01FC00 +0001FE01FC000001FE01FC000001FE01FC000001FE01FC000001FE01FC000001FE01FC00 +0001FE01FC000001FE01FC000001FE01FC000001FE01FC000001FE01FC000003FC01FC00 +0003FC01FC000003FC01FC000007F801FC000007F801FC000007F001FC00000FF001FE00 +000FE001FE00001FC001FF00003FC001FF00003F8001FF80007E0001FDC000FC0001FCF0 +03F80001FC3C0FE00001FC1FFF800001FC03FC000001FC0000000001FC0000000001FC00 +00000001FC0000000001FC0000000001FC0000000001FC0000000001FC0000000001FC00 +00000001FC0000000001FC0000000001FC0000000001FC0000000001FC0000000003FE00 +000000FFFFF8000000FFFFF8000000FFFFF80000002F3F7DAB36>112 +D<03F803F0FFF81FFCFFF83C3EFFF8707F07F8E0FF03F9C0FF01F980FF01FB80FF01FB00 +7E01FB003C01FF000001FE000001FE000001FE000001FE000001FC000001FC000001FC00 +0001FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC00 +0001FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC000001FC00 +0001FC000001FC000001FC000001FC000003FF0000FFFFFE00FFFFFE00FFFFFE00202C7D +AB26>114 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fh ecrm1728 17.28 16 /Fh 16 119 df> setpagedevice } -{ /a4 where { pop a4 } if } +{ pop << /PageSize [612 792] >> setpagedevice } +{ /letter where { pop letter } if } ifelse %%EndPaperSize end %%EndSetup %%Page: 1 1 TeXDict begin 1 0 bop 1038 872 a Fh(T)-11 b(oprammer)45 -b(-)g(Dev)l(elop)t(ers)h(guide)1583 1307 y Fg(Jan)m(uary)33 -b(18,)f(2011)515 1659 y Ff(1)131 b(De\034nitions)515 -1841 y Fe(DUT)42 b Fd(Device)19 b(Under)f(T)-7 b(est.)34 -b(The)18 b(device)h(put)g(in)n(to)f(the)h(ZIF)f(so)r(c)n(k)n(et)f(of)i -(the)g(programmer)515 2004 y Fe(VPP)42 b Fd(Programming)26 +b(-)g(Dev)l(elop)t(ers)h(guide)1669 1307 y Fg(April)31 +b(6,)h(2012)515 1659 y Ff(1)131 b(De\034nitions)515 1841 +y Fe(DUT)42 b Fd(Device)19 b(Under)f(T)-7 b(est.)34 b(The)18 +b(device)h(put)g(in)n(to)f(the)h(ZIF)f(so)r(c)n(k)n(et)f(of)i(the)g +(programmer)515 2004 y Fe(VPP)42 b Fd(Programming)26 b(v)n(oltage)f(for)j(the)f(DUT)i(\(usually)e(12V\))515 2168 y Fe(V)m(CCX)42 b Fd(Supply)28 b(v)n(oltage)e(for)h(the)h(DUT)515 2332 y Fe(GND)41 b Fd(Ground)27 b(for)g(the)h(DUT)515 @@ -3568,181 +3566,185 @@ b(Reimplemen)n(t)33 b(this,)722 4910 y(if)28 b(y)n(our)f(DUT)h(supp)r TeXDict begin 5 4 bop 515 523 a Fe(erase\(\))41 b Fd(Erase)d(the)g (DUT.)h(Reimplemen)n(t)g(this,)i(if)e(y)n(our)d(DUT)j(supp)r(orts)f (electrical)722 623 y(erasing.)515 789 y Fe(test\(\))j -Fd(Run)28 b(an)f(optional)f(unit-test)i(on)f(the)g(c)n(hip.)37 -b(The)27 b(con)n(v)n(enience)f(wrapp)r(er)g(gener-)722 -888 y(icT)-7 b(est\(self,)45 b(readF)-7 b(unc,)43 b(writeF)-7 -b(unc,)45 b(size\))c(ma)n(y)f(b)r(e)h(used)g(to)f(implemen)n(t)i(this) -722 988 y(metho)r(d.)515 1154 y Fe(readProgmem\(\))d -Fd(Read)22 b(the)g(program)e(memory)h(and)h(return)g(it.)35 -b(Reimplemen)n(t)23 b(this,)722 1254 y(if)28 b(y)n(our)f(DUT)h(has)f -(program)e(memory)i(and)h(supp)r(orts)f(reading)f(it.)515 -1420 y Fe(writeProgmem\(image\))36 b Fd(W)-7 b(rite)39 -b(the)h(program)c(memory)-7 b(.)71 b(Reimplemen)n(t)39 -b(this,)k(if)722 1519 y(y)n(our)27 b(DUT)h(has)f(program)e(memory)i -(and)g(supp)r(orts)h(writing)f(it.)515 1685 y Fe(readEEPR)m(OM\(\))41 -b Fd(Read)27 b(the)g(\(E\)EPR)n(OM)i(memory)d(and)h(return)f(it.)38 -b(Reimplemen)n(t)722 1785 y(this,)28 b(if)g(y)n(our)f(DUT)h(has)f -(\(E\)EPR)n(OM)i(memory)e(and)g(supp)r(orts)g(reading)g(it.)515 -1951 y Fe(writeEEPR)m(OM\(\))40 b Fd(W)-7 b(rite)28 b(the)g(\(E\)EPR)n -(OM)h(memory)-7 b(.)37 b(Reimplemen)n(t)28 b(this,)g(if)g(y)n(our)722 -2051 y(DUT)h(has)e(\(E\)EPR)n(OM)i(memory)d(and)i(supp)r(orts)f -(writing)g(it.)515 2217 y Fe(readF)-8 b(use\(\))42 b +Fd(Run)34 b(an)f(optional)g(unit-test)h(on)f(the)g(c)n(hip.)55 +b(The)33 b(generic)g(algorithm)f(Generi-)722 888 y(cAlgorithms.simpleT) +-7 b(est)27 b(ma)n(y)g(b)r(e)h(used)f(to)h(implemen)n(t)g(this)g(metho) +r(d.)515 1054 y Fe(readProgmem\(\))39 b Fd(Read)22 b(the)g(program)e +(memory)h(and)h(return)g(it.)35 b(Reimplemen)n(t)23 b(this,)722 +1154 y(if)28 b(y)n(our)f(DUT)h(has)f(program)e(memory)i(and)h(supp)r +(orts)f(reading)f(it.)515 1320 y Fe(writeProgmem\(image\))36 +b Fd(W)-7 b(rite)39 b(the)h(program)c(memory)-7 b(.)71 +b(Reimplemen)n(t)39 b(this,)k(if)722 1420 y(y)n(our)27 +b(DUT)h(has)f(program)e(memory)i(and)g(supp)r(orts)h(writing)f(it.)515 +1586 y Fe(readEEPR)m(OM\(\))41 b Fd(Read)27 b(the)g(\(E\)EPR)n(OM)i +(memory)d(and)h(return)f(it.)38 b(Reimplemen)n(t)722 +1685 y(this,)28 b(if)g(y)n(our)f(DUT)h(has)f(\(E\)EPR)n(OM)i(memory)e +(and)g(supp)r(orts)g(reading)g(it.)515 1851 y Fe(writeEEPR)m(OM\(\))40 +b Fd(W)-7 b(rite)28 b(the)g(\(E\)EPR)n(OM)h(memory)-7 +b(.)37 b(Reimplemen)n(t)28 b(this,)g(if)g(y)n(our)722 +1951 y(DUT)h(has)e(\(E\)EPR)n(OM)i(memory)d(and)i(supp)r(orts)f +(writing)g(it.)515 2117 y Fe(readF)-8 b(use\(\))42 b Fd(Read)31 b(the)h(F)-7 b(use)32 b(memory)f(and)h(return)f(it.)50 -b(Reimplemen)n(t)33 b(this,)g(if)f(y)n(our)722 2316 y(DUT)d(has)e(F)-7 -b(uses)27 b(and)g(supp)r(orts)g(reading)g(them.)515 2482 +b(Reimplemen)n(t)33 b(this,)g(if)f(y)n(our)722 2217 y(DUT)d(has)e(F)-7 +b(uses)27 b(and)g(supp)r(orts)g(reading)g(them.)515 2383 y Fe(writeF)-8 b(use\(\))41 b Fd(W)-7 b(rite)19 b(the)g(F)-7 b(use)20 b(memory)-7 b(.)33 b(Reimplemen)n(t)19 b(this,)j(if)d(y)n(our) -f(DUT)i(has)e(F)-7 b(uses)722 2582 y(and)28 b(supp)r(orts)f(writing)g -(them.)515 2748 y Fe(readLo)s(c)m(kbits\(\))42 b Fd(Read)31 +f(DUT)i(has)e(F)-7 b(uses)722 2482 y(and)28 b(supp)r(orts)f(writing)g +(them.)515 2648 y Fe(readLo)s(c)m(kbits\(\))42 b Fd(Read)31 b(the)h(Lo)r(c)n(kbit)g(memory)e(and)i(return)f(it.)49 -b(Reimplemen)n(t)32 b(this,)722 2848 y(if)c(y)n(our)f(DUT)h(has)f(Lo)r +b(Reimplemen)n(t)32 b(this,)722 2748 y(if)c(y)n(our)f(DUT)h(has)f(Lo)r (c)n(kbits)g(and)g(supp)r(orts)g(reading)g(them.)515 -3014 y Fe(writeLo)s(c)m(kbits\(\))41 b Fd(W)-7 b(rite)30 +2914 y Fe(writeLo)s(c)m(kbits\(\))41 b Fd(W)-7 b(rite)30 b(the)f(Lo)r(c)n(kbit)g(memory)-7 b(.)41 b(Reimplemen)n(t)29 -b(this,)h(if)g(y)n(our)d(DUT)722 3113 y(has)g(Lo)r(c)n(kbits)g(and)h -(supp)r(orts)f(writing)g(them.)515 3279 y Fe(readRAM\(\))41 +b(this,)h(if)g(y)n(our)d(DUT)722 3014 y(has)g(Lo)r(c)n(kbits)g(and)h +(supp)r(orts)f(writing)g(them.)515 3180 y Fe(readRAM\(\))41 b Fd(Read)c(the)g(Random)g(A)n(ccess)f(Memory)-7 b(.)65 -b(Reimplemen)n(t)37 b(this,)j(if)d(y)n(our)722 3379 y(DUT)29 -b(has)e(RAM)h(and)f(supp)r(orts)g(reading)f(it.)515 3545 +b(Reimplemen)n(t)37 b(this,)j(if)d(y)n(our)722 3279 y(DUT)29 +b(has)e(RAM)h(and)f(supp)r(orts)g(reading)f(it.)515 3445 y Fe(writeRAM\(\))40 b Fd(W)-7 b(rite)33 b(the)f(Random)g(A)n(ccess)f (Memory)-7 b(.)50 b(Reimplemen)n(t)32 b(this,)i(if)e(y)n(our)722 -3645 y(DUT)d(has)e(RAM)h(and)f(supp)r(orts)g(writing)g(to)h(it.)515 -3811 y(After)e(de\034ning)g(y)n(our)e(\020Chip\021-deriv)n(ed)h(class)g +3545 y(DUT)d(has)e(RAM)h(and)f(supp)r(orts)g(writing)g(to)h(it.)515 +3711 y(After)e(de\034ning)g(y)n(our)e(\020Chip\021-deriv)n(ed)h(class)g (y)n(ou)g(need)h(to)f(register)g(it.)36 b(This)26 b(is)g(done)f(b)n(y) -515 3910 y(de\034ning)i(a)g(ChipDescription\(\):)722 -4193 y Fa(ChipDescription\(C)o(hi)o(p_)o(MyD)o(ev)o(ic)o(e,)37 +515 3811 y(de\034ning)i(a)g(ChipDescription\(\):)722 +4093 y Fa(ChipDescription\(C)o(hi)o(p_)o(MyD)o(ev)o(ic)o(e,)37 b(bitfile)k(=)i(\020bitfileID\021,)38 b(chipID)j(=)j -(\020myChipID\021\))515 4375 y Fd(The)39 b(c)n(hip)g(class)f(\(_not_)g +(\020myChipID\021\))515 4276 y Fd(The)39 b(c)n(hip)g(class)f(\(_not_)g (an)h(instance)g(of)g(it\))g(is)g(passed)f(as)h(\034rst)f(parameter.)70 -b(The)515 4475 y(ID)33 b(string)f(of)g(the)h(required)f(bit\034le)h(is) +b(The)515 4375 y(ID)33 b(string)f(of)g(the)h(required)f(bit\034le)h(is) g(past)f(as)g(second)g(parameter.)50 b(A)33 b(c)n(hipID)g(migh)n(t)515 -4575 y(also)28 b(b)r(e)h(passed.)41 b(If)29 b(the)g(c)n(hipID)h(is)f +4475 y(also)28 b(b)r(e)h(passed.)41 b(If)29 b(the)g(c)n(hipID)h(is)f (omitted,)h(the)f(bit\034leID)h(is)f(used)g(as)f(c)n(hipID.)i(There)515 -4674 y(are)g(more)h(optional)g(parameters)e(to)j(ChipDescription\(\).) -49 b(See)31 b(the)h(inline)g(sourceco)r(de)515 4774 y(do)r(cumen)n +4575 y(are)g(more)h(optional)g(parameters)e(to)j(ChipDescription\(\).) +49 b(See)31 b(the)h(inline)g(sourceco)r(de)515 4674 y(do)r(cumen)n (tation)27 b(for)g(details.)1926 5255 y(5)p eop end %%Page: 6 6 -TeXDict begin 6 5 bop 515 523 a Fb(5.2)112 b(FPGA)37 -b(b)s(ottom-half)g(implemen)m(tation)515 676 y Fd(F)-7 -b(or)25 b(the)i(FPGA)h(part)e(y)n(ou)f(need)i(to)f(get)g(the)h(Xilinx)g -(dev)n(elopmen)n(t)f(suite)g(\(ISE\))i(v)n(ersion)515 -776 y(10.1)d(service)g(pac)n(k)h(3.)36 b(The)26 b("W)-7 +TeXDict begin 6 5 bop 515 523 a Fb(5.2)112 b(Generic)37 +b(top-half)g(algorithms)515 676 y Fd(The)f(Python)h(class)f +(\020GenericAlgorithms\021)42 b(in)36 b(the)h(generic_algorithms.p)n(y) +c(\034le)k(pro-)515 776 y(vides)j(sev)n(eral)e(generic)i(c)n(hip)g +(access)f(algorithms)g(that)i(can)f(b)r(e)h(used)f(in)h(the)g +(\020Chip\021)515 876 y(metho)r(ds.)515 1108 y Fb(5.3)112 +b(FPGA)37 b(b)s(ottom-half)g(implemen)m(tation)515 1261 +y Fd(F)-7 b(or)25 b(the)i(FPGA)h(part)e(y)n(ou)f(need)i(to)f(get)g(the) +h(Xilinx)g(dev)n(elopmen)n(t)f(suite)g(\(ISE\))i(v)n(ersion)515 +1361 y(10.1)d(service)g(pac)n(k)h(3.)36 b(The)26 b("W)-7 b(ebP)g(A)n(CK",)26 b(whic)n(h)h(is)f(su\036cien)n(t)g(for)g(our)g -(purp)r(oses,)f(can)515 876 y(b)r(e)j(do)n(wnloaded)e(for)h(free)g +(purp)r(oses,)f(can)515 1460 y(b)r(e)j(do)n(wnloaded)e(for)h(free)g (\(as)g(in)h(b)r(eer\))g(from)f(the)h(Xilinx)g(homepage:)722 -1058 y Fa(http://www.xilinx)o(.c)o(om)o(/su)o(pp)o(or)o(t/d)o(ow)o(nl)o -(oad)o(/i)o(nd)o(ex.)o(ht)o(m)515 1241 y Fd(T)-7 b(o)24 +1643 y Fa(http://www.xilinx)o(.c)o(om)o(/su)o(pp)o(or)o(t/d)o(ow)o(nl)o +(oad)o(/i)o(nd)o(ex.)o(ht)o(m)515 1826 y Fd(T)-7 b(o)24 b(create)f(a)g(new)i(sourceco)r(de)d(template)j(\034leset)f(for)f(a)h -(new)g(c)n(hip,)h(go)e(to)i(the)f(libtopram-)515 1340 +(new)g(c)n(hip,)h(go)e(to)i(the)f(libtopram-)515 1925 y(mer/bit/src/)h(sub)r(directory)i(and)g(execute)g(the)h("create.sh")e -(script:)722 1523 y Fa(./create.sh)39 b(bitfile_name)515 -1706 y Fd(Where)20 b("bit\034le_name")g(is)h(the)g(name)f(of)h(the)g +(script:)722 2108 y Fa(./create.sh)39 b(bitfile_name)515 +2291 y Fd(Where)20 b("bit\034le_name")g(is)h(the)g(name)f(of)h(the)g (new)g(c)n(hip's)g(bit\034le.)35 b(\(That)21 b(often)g(matc)n(hes)515 -1805 y(the)37 b(c)n(hip-ID\).)h(No)n(w)f(go)f(to)h +2390 y(the)37 b(c)n(hip-ID\).)h(No)n(w)f(go)f(to)h (libtoprammer/bit/src/bit\034le_name/)d(and)j(implemen)n(t)515 -1905 y(the)27 b(b)r(ottom-half)f(algorithm)g(in)g(the)h +2490 y(the)27 b(b)r(ottom-half)f(algorithm)g(in)g(the)h (bit\034le_name.v)g(V)-7 b(erilog)25 b(\034le.)37 b(T)-7 -b(o)26 b(build)h(the)g(.BIT)515 2005 y(\034le)21 b(from)g(the)h(V)-7 +b(o)26 b(build)h(the)g(.BIT)515 2589 y(\034le)21 b(from)g(the)h(V)-7 b(erilog)20 b(sources,)h(go)f(to)h(the)h(libtoprammer/bit/)d(directory) -h(and)h(execute:)722 2187 y Fa(./build.sh)40 b(bitfile_name)515 -2370 y Fd(\(if)28 b(y)n(ou)f(omit)h(the)f(bit\034le_name,)h(all)f -(bit\034les)h(will)g(b)r(e)g(rebuilt\).)515 2644 y Ff(6)131 -b(Automatic)44 b(la)l(y)l(out)h(generator)515 2826 y +h(and)h(execute:)722 2772 y Fa(./build.sh)40 b(bitfile_name)515 +2955 y Fd(\(if)28 b(y)n(ou)f(omit)h(the)f(bit\034le_name,)h(all)f +(bit\034les)h(will)g(b)r(e)g(rebuilt\).)515 3229 y Ff(6)131 +b(Automatic)44 b(la)l(y)l(out)h(generator)515 3411 y Fd(The)39 b(automatic)f(la)n(y)n(out)g(generator)f(\(la)n(y)n (out_generator.p)n(y\))e(can)k(b)r(e)g(used)g(to)g(auto-)515 -2926 y(matically)27 b(generate)f(a)i(V)n(CC/VPP/GND)h(la)n(y)n(out.)36 +3511 y(matically)27 b(generate)f(a)i(V)n(CC/VPP/GND)h(la)n(y)n(out.)36 b(The)28 b(generator)d(will)j(then)h(tell)f(y)n(ou)515 -3026 y(ho)n(w)j(to)i(insert)f(the)g(c)n(hip)h(in)n(to)f(the)g(ZIF)h(so) +3610 y(ho)n(w)j(to)i(insert)f(the)g(c)n(hip)h(in)n(to)f(the)g(ZIF)h(so) r(c)n(k)n(et.)50 b(The)32 b(adv)-5 b(an)n(tage)31 b(of)h(using)g(the)h -(auto-)515 3125 y(generator)d(instead)j(of)f(hardco)r(ding)g(the)h(V)n -(CC/VPP/GND)g(connections)f(in)h(the)g(c)n(hip)515 3225 +(auto-)515 3710 y(generator)d(instead)j(of)f(hardco)r(ding)g(the)h(V)n +(CC/VPP/GND)g(connections)f(in)h(the)g(c)n(hip)515 3810 y(implemen)n(tation)26 b(is)f(that)h(the)h(autogenerated)d(la)n(y)n (out)g(is)i(p)r(ortable)f(b)r(et)n(w)n(een)h(TOPxxxx)515 -3324 y(programmers)c(and)i(it)h(is)g(m)n(uc)n(h)f(easier)f(to)i +3909 y(programmers)c(and)i(it)h(is)g(m)n(uc)n(h)f(easier)f(to)i (implemen)n(t.)36 b(Y)-7 b(ou)25 b(do)f(not)h(ha)n(v)n(e)e(to)i(searc)n -(h)e(for)515 3424 y(a)k(c)n(hip)g(p)r(osition)g(in)h(the)f(ZIF)h(so)r +(h)e(for)515 4009 y(a)k(c)n(hip)g(p)r(osition)g(in)h(the)f(ZIF)h(so)r (c)n(k)n(et)e(that)h(\034ts)h(the)g(device)f(constrain)n(ts.)35 -b(The)27 b(autogen-)515 3524 y(erator)f(will)h(do)h(it)g(for)f(y)n(ou.) -639 3623 y(The)20 b(c)n(hip)g(in)n(terface)f(of)h(the)g(autogenerator)e +b(The)27 b(autogen-)515 4109 y(erator)f(will)h(do)h(it)g(for)f(y)n(ou.) +639 4208 y(The)20 b(c)n(hip)g(in)n(terface)f(of)h(the)g(autogenerator)e (is)h(em)n(b)r(edded)i(in)n(to)e(\020class)g(Chip\021.)34 -b(So)20 b(y)n(ou)515 3723 y(don't)28 b(ha)n(v)n(e)f(to)h(w)n(ork)f +b(So)20 b(y)n(ou)515 4308 y(don't)28 b(ha)n(v)n(e)f(to)h(w)n(ork)f (with)i(\020class)e(La)n(y)n(outGenerator\021)k(directly)-7 -b(.)39 b(Y)-7 b(ou'll)28 b(do)g(it)h(through)515 3823 +b(.)39 b(Y)-7 b(ou'll)28 b(do)g(it)h(through)515 4407 y(\020class)d(Chip\021)34 b(instead.)j(So)27 b(let's)h(lo)r(ok)f(at)g (\020class)g(Chip\021s)g(autogenerator)e(in)n(terface.)639 -3922 y(The)j(constructor)e(\(__init__\(\)\))h(has)g(some)g -(autogenerator)e(related)i(parameters:)515 4088 y Fe(c)m(hipP)m(ac)m(k) +4507 y(The)j(constructor)e(\(__init__\(\)\))h(has)g(some)g +(autogenerator)e(related)i(parameters:)515 4673 y Fe(c)m(hipP)m(ac)m(k) -5 b(age)43 b Fd(This)36 b(parameter)e(is)i(a)f(string)h(iden)n (tifying)g(the)g(pac)n(k)-5 b(age)34 b(t)n(yp)r(e)i(of)g(the)722 -4188 y(DUT)26 b(c)n(hip.)36 b(It)25 b(is)g(something)g(lik)n(e)f +4773 y(DUT)26 b(c)n(hip.)36 b(It)25 b(is)g(something)g(lik)n(e)f (\020DIP28\021)31 b(or)25 b(\020DIP40\021,)f(etc...)37 -b(.)f(If)25 b(this)h(param-)722 4287 y(eter)i(is)f(passed)g(to)g(the)h -(constructor,)e(the)i(autogenerator)d(is)i(enabled.)515 -4453 y Fe(c)m(hipPin)-8 b(V)m(CCX)42 b Fd(This)34 b(parameter)e(is)i -(an)g(in)n(teger)f(sp)r(ecifying)h(the)h(V)n(CC)f(pin)g(on)g(the)722 -4553 y(c)n(hip)26 b(pac)n(k)-5 b(age.)35 b(Note)26 b(that)g(it)h(sp)r -(eci\034es)f(the)g(V)n(CC)g(pin)h(on)e(the)i(c)n(hip)f(pac)n(k)-5 -b(age)24 b(and)722 4653 y(_not_)h(on)g(the)g(ZIF)h(so)r(c)n(k)n(et.)35 -b(So)25 b(if)g(y)n(our)g(c)n(hip)g(datasheet)f(tells)i(y)n(ou)e(that)i -(V)n(CC)f(is)722 4752 y(on)j(pin)g(8,)f(y)n(ou)g(pass)f(an)i(8)f(here.) -1926 5255 y(6)p eop end +b(.)f(If)25 b(this)h(param-)722 4872 y(eter)i(is)f(passed)g(to)g(the)h +(constructor,)e(the)i(autogenerator)d(is)i(enabled.)1926 +5255 y(6)p eop end %%Page: 7 7 -TeXDict begin 7 6 bop 515 523 a Fe(c)m(hipPinsVPP)42 -b Fd(This)27 b(parameter)e(is)i(an)f(in)n(teger)g(or)h(a)f(list)h(of)g -(in)n(tegers)f(sp)r(ecifying)h(the)722 623 y(VPP)d(pin\(s\))f(on)f(the) -h(c)n(hip)g(pac)n(k)-5 b(age.)33 b(Note)23 b(that)g(it)g(sp)r -(eci\034es)f(the)h(VPP)h(pin)f(on)f(the)722 722 y(c)n(hip)i(pac)n(k)-5 -b(age)22 b(and)h(_not_)f(on)i(the)f(ZIF)h(so)r(c)n(k)n(et.)34 -b(So)23 b(if)h(y)n(our)f(c)n(hip)g(datasheet)g(tells)722 -822 y(y)n(ou)28 b(that)h(VPP)h(is)f(on)f(pin)i(1,)e(y)n(ou)g(pass)g(a)g -(1)h(here.)40 b(If)29 b(y)n(our)e(c)n(hip)i(needs)g(m)n(ultiple)722 -922 y(VPP)f(v)n(oltages,)d(just)i(pass)f(a)g(list)h(of)f(pins.)37 -b(Sp)r(ecify)27 b(all)f(p)r(ossible)g(VPP)i(pins)f(here.)722 -1021 y(Whic)n(h)h(pin)g(is)g(actually)e(activ)-5 b(ated)28 -b(is)f(decided)h(later)f(in)h(applyVPP\(\).)515 1187 -y Fe(c)m(hipPinGND)41 b Fd(This)d(parameter)e(is)i(an)g(in)n(teger)e -(sp)r(ecifying)i(the)g(GND)h(pin)f(on)g(the)722 1287 -y(c)n(hip)25 b(pac)n(k)-5 b(age.)35 b(Note)25 b(that)g(it)h(sp)r +TeXDict begin 7 6 bop 515 523 a Fe(c)m(hipPin)-8 b(V)m(CCX)42 +b Fd(This)34 b(parameter)e(is)i(an)g(in)n(teger)f(sp)r(ecifying)h(the)h +(V)n(CC)f(pin)g(on)g(the)722 623 y(c)n(hip)26 b(pac)n(k)-5 +b(age.)35 b(Note)26 b(that)g(it)h(sp)r(eci\034es)f(the)g(V)n(CC)g(pin)h +(on)e(the)i(c)n(hip)f(pac)n(k)-5 b(age)24 b(and)722 722 +y(_not_)h(on)g(the)g(ZIF)h(so)r(c)n(k)n(et.)35 b(So)25 +b(if)g(y)n(our)g(c)n(hip)g(datasheet)f(tells)i(y)n(ou)e(that)i(V)n(CC)f +(is)722 822 y(on)j(pin)g(8,)f(y)n(ou)g(pass)f(an)i(8)f(here.)515 +988 y Fe(c)m(hipPinsVPP)42 b Fd(This)27 b(parameter)e(is)i(an)f(in)n +(teger)g(or)h(a)f(list)h(of)g(in)n(tegers)f(sp)r(ecifying)h(the)722 +1088 y(VPP)d(pin\(s\))f(on)f(the)h(c)n(hip)g(pac)n(k)-5 +b(age.)33 b(Note)23 b(that)g(it)g(sp)r(eci\034es)f(the)h(VPP)h(pin)f +(on)f(the)722 1187 y(c)n(hip)i(pac)n(k)-5 b(age)22 b(and)h(_not_)f(on)i +(the)f(ZIF)h(so)r(c)n(k)n(et.)34 b(So)23 b(if)h(y)n(our)f(c)n(hip)g +(datasheet)g(tells)722 1287 y(y)n(ou)28 b(that)h(VPP)h(is)f(on)f(pin)i +(1,)e(y)n(ou)g(pass)g(a)g(1)h(here.)40 b(If)29 b(y)n(our)e(c)n(hip)i +(needs)g(m)n(ultiple)722 1386 y(VPP)f(v)n(oltages,)d(just)i(pass)f(a)g +(list)h(of)f(pins.)37 b(Sp)r(ecify)27 b(all)f(p)r(ossible)g(VPP)i(pins) +f(here.)722 1486 y(Whic)n(h)h(pin)g(is)g(actually)e(activ)-5 +b(ated)28 b(is)f(decided)h(later)f(in)h(applyVPP\(\).)515 +1652 y Fe(c)m(hipPinGND)41 b Fd(This)d(parameter)e(is)i(an)g(in)n +(teger)e(sp)r(ecifying)i(the)g(GND)h(pin)f(on)g(the)722 +1752 y(c)n(hip)25 b(pac)n(k)-5 b(age.)35 b(Note)25 b(that)g(it)h(sp)r (eci\034es)f(the)h(GND)g(pin)f(on)g(the)h(c)n(hip)f(pac)n(k)-5 -b(age)23 b(and)722 1386 y(_not_)30 b(on)g(the)h(ZIF)f(so)r(c)n(k)n(et.) +b(age)23 b(and)722 1851 y(_not_)30 b(on)g(the)h(ZIF)f(so)r(c)n(k)n(et.) 44 b(So)30 b(if)h(y)n(our)e(c)n(hip)i(datasheet)e(tells)i(y)n(ou)f -(that)g(GND)722 1486 y(is)e(on)f(pin)h(5,)f(y)n(ou)g(pass)g(a)g(5)g -(here.)515 1652 y(After)h(passing)e(all)h(parameters)f(to)h(the)h +(that)g(GND)722 1951 y(is)e(on)f(pin)h(5,)f(y)n(ou)g(pass)g(a)g(5)g +(here.)515 2117 y(After)h(passing)e(all)h(parameters)f(to)h(the)h (\020class)e(Chip\021)34 b(constructor,)26 b(the)i(autogenerator)515 -1752 y(is)g(initialized)h(and)g(ready)f(to)h(b)r(e)g(used.)40 +2217 y(is)g(initialized)h(and)g(ready)f(to)h(b)r(e)g(used.)40 b(The)29 b(follo)n(wing)f(\020class)f(Chip\021)36 b(metho)r(ds)29 -b(can)g(b)r(e)515 1851 y(used)e(to)h(enable)f(or)g(disable)g(a)g(la)n -(y)n(out:)515 2017 y Fe(applyV)m(CCX\(on\))42 b Fd(This)f(metho)r(d)g +b(can)g(b)r(e)515 2316 y(used)e(to)h(enable)f(or)g(disable)g(a)g(la)n +(y)n(out:)515 2482 y Fe(applyV)m(CCX\(on\))42 b Fd(This)f(metho)r(d)g (enables)f(or)g(disables)g(\(dep)r(ending)i(on)e(the)h(\020on\021)722 -2117 y(parameter\))34 b(the)i(V)n(CC)f(la)n(y)n(out.)58 +2582 y(parameter\))34 b(the)i(V)n(CC)f(la)n(y)n(out.)58 b(Enabling)35 b(the)h(la)n(y)n(out)e(means)g(that)i(the)f(V)n(CC)722 -2217 y(pin)29 b(will)g(b)r(e)g(activ)n(ely)f(driv)n(en)g(b)n(y)h(the)g +2682 y(pin)29 b(will)g(b)r(e)g(activ)n(ely)f(driv)n(en)g(b)n(y)h(the)g (con\034gured)e(V)n(CC)i(v)n(oltage.)38 b(Disabling)29 -b(the)722 2316 y(la)n(y)n(out)e(will)g(tristate)h(the)g(driv)n(er.)515 -2482 y Fe(applyVPP\(on,pac)m(k)-5 b(agePinsT)d(oT)g(urnOn\))43 +b(the)722 2781 y(la)n(y)n(out)e(will)g(tristate)h(the)g(driv)n(er.)515 +2947 y Fe(applyVPP\(on,pac)m(k)-5 b(agePinsT)d(oT)g(urnOn\))43 b Fd(This)18 b(metho)r(d)h(enables)f(or)f(disables)h(\(de-)722 -2582 y(p)r(ending)39 b(on)f(the)g(\020on\021)45 b(parameter\))37 +3047 y(p)r(ending)39 b(on)f(the)g(\020on\021)45 b(parameter\))37 b(the)h(VPP)i(la)n(y)n(out.)67 b(Enabling)39 b(the)f(la)n(y)n(out)722 -2682 y(means)30 b(that)h(the)g(VPP)h(pins)f(will)g(b)r(e)g(activ)n(ely) -e(driv)n(en)h(b)n(y)g(the)h(con\034gured)f(VPP)722 2781 +3147 y(means)30 b(that)h(the)g(VPP)h(pins)f(will)g(b)r(e)g(activ)n(ely) +e(driv)n(en)h(b)n(y)g(the)h(con\034gured)f(VPP)722 3246 y(v)n(oltage.)36 b(Disabling)27 b(the)h(la)n(y)n(out)f(will)g(tristate) h(the)g(driv)n(er.)36 b(The)27 b(\034rst)h(parameter)722 -2881 y(\020on\021)i(is)24 b(a)f(b)r(o)r(olean)g(to)g(turn)h(ON)g(or)f +3346 y(\020on\021)i(is)24 b(a)f(b)r(o)r(olean)g(to)g(turn)h(ON)g(or)f (OFF)g(the)h(VPP)h(la)n(y)n(out.)35 b(The)24 b(second)f(param-)722 -2980 y(eter)34 b(is)g(an)g(optional)g(list)g(of)h(pac)n(k)-5 +3445 y(eter)34 b(is)g(an)g(optional)g(list)g(of)h(pac)n(k)-5 b(age-pin-n)n(um)n(b)r(ers)31 b(sp)r(ecifying)j(whic)n(h)h(VPP)g(is)722 -3080 y(turned)29 b(on.)40 b(If)30 b(the)f(second)f(parameter)f(is)i +3545 y(turned)29 b(on.)40 b(If)30 b(the)f(second)f(parameter)f(is)i (not)g(passed,)f(all)h(p)r(ossible)f(VPPs)i(that)722 -3180 y(w)n(ere)d(sp)r(eci\034ed)i(in)f(the)g(constructor)f(are)g +3645 y(w)n(ere)d(sp)r(eci\034ed)i(in)f(the)g(constructor)f(are)g (turned)h(on.)38 b(The)28 b(second)g(parameter)e(is)722 -3279 y(un)n(used,)i(if)g(\020on=F)-7 b(alse\021.)515 -3445 y Fe(applyGND\(on\))42 b Fd(This)29 b(metho)r(d)h(enables)f(or)g +3744 y(un)n(used,)i(if)g(\020on=F)-7 b(alse\021.)515 +3910 y Fe(applyGND\(on\))42 b Fd(This)29 b(metho)r(d)h(enables)f(or)g (disables)g(\(dep)r(ending)i(on)e(the)h(\020on\021)36 -b(pa-)722 3545 y(rameter\))25 b(the)h(GND)h(la)n(y)n(out.)35 +b(pa-)722 4010 y(rameter\))25 b(the)h(GND)h(la)n(y)n(out.)35 b(Enabling)26 b(the)g(la)n(y)n(out)e(means)h(that)h(the)g(GND)h(pins) -722 3645 y(will)41 b(b)r(e)g(activ)n(ely)f(driv)n(en)g(b)n(y)g(GND.)i +722 4110 y(will)41 b(b)r(e)g(activ)n(ely)f(driv)n(en)g(b)n(y)g(GND.)i (Disabling)e(the)h(la)n(y)n(out)f(will)g(tristate)h(the)722 -3744 y(driv)n(er.)1926 5255 y(7)p eop end +4209 y(driv)n(er.)1926 5255 y(7)p eop end %%Trailer userdict /end-hook known{end-hook}if diff --git a/libtoprammer/chip.py b/libtoprammer/chip.py index 64553a6..43c2435 100644 --- a/libtoprammer/chip.py +++ b/libtoprammer/chip.py @@ -3,7 +3,7 @@ # # Chip support # -# Copyright (c) 2009-2011 Michael Buesch +# Copyright (c) 2009-2012 Michael Buesch # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ from util import * from layout_generator import * from user_interface import * +from generic_algorithms import * class Chip: @@ -168,21 +169,10 @@ class Chip: self.top.progressMeter(AbstractUserInterface.PROGRESSMETER_CHIPACCESS, step) - def genericTest(self, readFunc, writeFunc, size): - "Generic test. Call from test() in the chip implementation, if desired." - image = genRandomBlob(size) - writeFunc(image) - if readFunc() != image: - self.throwError("Unit-test failed. The chip may be physically broken.") - def shutdownChip(self): # Override me in the subclass, if required. self.printDebug("Default chip shutdown") - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - self.top.cmdSetVCCXVoltage(self.top.vccx.minVoltage()) - self.top.cmdSetVPPVoltage(self.top.vpp.minVoltage()) + GenericAlgorithms(self).simpleVoltageShutdown() def readSignature(self): # Override me in the subclass, if required. diff --git a/libtoprammer/chip_at27c256r.py b/libtoprammer/chip_at27c256r.py index d62aff2..3e498a2 100644 --- a/libtoprammer/chip_at27c256r.py +++ b/libtoprammer/chip_at27c256r.py @@ -22,6 +22,7 @@ from chip import * + class Chip_at27c256r(Chip): def __init__(self): Chip.__init__(self, @@ -30,48 +31,25 @@ class Chip_at27c256r(Chip): chipPinsVPP = 1, chipPinGND = 14) self.sizeBytes = 32 * 1024 + self.generic = GenericAlgorithms(self) + self.addrSetter = AddrSetter(self, 0x10, 0x11) def readEEPROM(self): self.__turnOn() - self.progressMeterInit("Reading EPROM", self.sizeBytes) - image, prevAddr, count = b"", None, 0 - self.__setFlags(oe=0, ce=0) - for addr in range(0, self.sizeBytes): - self.progressMeter(addr) - if prevAddr is None or\ - (prevAddr & 0xFF) != (addr & 0xFF): - self.__setAddrLow(addr & 0xFF) - if prevAddr is None or\ - ((prevAddr >> 8) & 0xFF) != ((addr >> 8) & 0xFF): - self.__setAddrHigh((addr >> 8) & 0xFF) - prevAddr = addr - self.__dataRead() - count += 1 - if count == self.top.getBufferRegSize(): - image += self.top.cmdReadBufferReg() - count = 0 - if count: - image += self.top.cmdReadBufferReg() - self.__setFlags(oe=1, ce=1) - self.progressMeterFinish() - return image + return self.generic.simpleReadEPROM( + sizeBytes = self.sizeBytes, + readData8Func = self.__dataRead, + addrSetter = self.addrSetter, + initFunc = lambda: self.__setFlags(oe=0, ce=0), + exitFunc = lambda: self.__setFlags(oe=1, ce=1) + ) # def writeEEPROM(self): # pass#TODO def __turnOn(self): self.__setFlags() - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(5) - self.applyVCCX(True) - self.applyVPP(False) - self.applyGND(True) - - def __setAddrLow(self, value): - self.top.cmdFPGAWrite(0x10, value) - - def __setAddrHigh(self, value): - self.top.cmdFPGAWrite(0x11, value) + self.generic.simpleVoltageSetup() def __setDataPins(self, value): self.top.cmdFPGAWrite(0x12, value) diff --git a/libtoprammer/chip_generic_sram.py b/libtoprammer/chip_generic_sram.py index 79426e7..4f4ee4f 100644 --- a/libtoprammer/chip_generic_sram.py +++ b/libtoprammer/chip_generic_sram.py @@ -41,8 +41,9 @@ class Chip_genericSRAM(Chip): self.writeRAM(int2byte(0) * self.__sizeBytes()) def test(self): - self.genericTest(self.readRAM, self.writeRAM, - self.__sizeBytes()) + generic = GenericAlgorithms(self) + generic.simpleTest(self.readRAM, self.writeRAM, + self.__sizeBytes()) def readRAM(self): image = [] diff --git a/libtoprammer/generic_algorithms.py b/libtoprammer/generic_algorithms.py new file mode 100644 index 0000000..6a2d405 --- /dev/null +++ b/libtoprammer/generic_algorithms.py @@ -0,0 +1,143 @@ +""" +# TOP2049 Open Source programming suite +# +# Generic programming algorithms +# +# Copyright (c) 2012 Michael Buesch +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +""" + +from util import * + + +class AddrSetter(object): + """Generic address setter""" + + def __init__(self, chip, + fpgaCmdByte0, + fpgaCmdByte1 = -1, + fpgaCmdByte2 = -1, + fpgaCmdByte3 = -1, + addrSetupFunc = lambda byteNr, data: None, + addrFinishFunc = lambda byteNr, data: None): + """ + chip => The Chip. + fpgaCmdByte0 => FPGA command number for setting addr byte 0. + fpgaCmdByte1 => FPGA command number for setting addr byte 1. + fpgaCmdByte2 => FPGA command number for setting addr byte 2. + fpgaCmdByte3 => FPGA command number for setting addr byte 3. + addrSetupFunc => Optional function called before addr write. + addrFinishFunc => Optional function called after addr write. + """ + self.chip = chip + self.fpgaCmds = [ + fpgaCmdByte0, + fpgaCmdByte1, + fpgaCmdByte2, + fpgaCmdByte3, + ] + self.addrSetupFunc = addrSetupFunc + self.addrFinishFunc = addrFinishFunc + self.reset() + + def reset(self): + self.prevAddr = None + + def load(self, addr): + """Load an address into the FPGA. + This loads only the bytes that changed.""" + shifts = (0, 8, 16, 24) + for byteNr, shift in enumerate(shifts): + fpgaCmd = self.fpgaCmds[byteNr] + if fpgaCmd < 0: + continue + addrByte = (addr >> shift) & 0xFF + if self.prevAddr is None or\ + ((self.prevAddr >> shift) & 0xFF) != addrByte: + self.addrSetupFunc(byteNr, addrByte) + self.chip.top.cmdFPGAWrite(fpgaCmd, addrByte) + self.addrSetupFunc(byteNr, addrByte) + self.prevAddr = addr + +class GenericAlgorithms(object): + """Generic programming algorithms.""" + + def __init__(self, chip): + self.chip = chip + + def simpleVoltageSetup(self, vcc=5.0, vpp=5.0, vppEnable=False): + """Simple voltage setup.""" + self.chip.top.cmdSetVCCXVoltage(vcc) + self.chip.top.cmdSetVPPVoltage(vpp) + self.chip.applyVCCX(True) + self.chip.applyGND(True) + self.chip.applyVPP(vppEnable) + + def simpleVoltageShutdown(self): + """Turn off voltages.""" + self.chip.applyVCCX(False) + self.chip.applyVPP(False) + self.chip.applyGND(False) + self.chip.top.cmdSetVCCXVoltage(self.chip.top.vccx.minVoltage()) + self.chip.top.cmdSetVPPVoltage(self.chip.top.vpp.minVoltage()) + + def simpleRead(self, name, sizeBytes, + readData8Func, + addrSetter, + initFunc = lambda: None, + exitFunc = lambda: None): + """Simple 8-bit data read algorithm.""" + self.chip.progressMeterInit("Reading %s" % name, sizeBytes) + image, count = [], 0 + initFunc() + addrSetter.reset() + for addr in range(0, sizeBytes): + self.chip.progressMeter(addr) + addrSetter.load(addr) + readData8Func() + count += 1 + if count == self.chip.top.getBufferRegSize(): + image.append(self.chip.top.cmdReadBufferReg()) + count = 0 + if count: + image.append(self.chip.top.cmdReadBufferReg()[:count]) + exitFunc() + self.chip.progressMeterFinish() + return b"".join(image) + + def simpleReadEPROM(self, sizeBytes, + readData8Func, + addrSetter, + initFunc = lambda: None, + exitFunc = lambda: None): + return self.simpleRead("EPROM", sizeBytes, readData8Func, + addrSetter, initFunc, exitFunc) + + def simpleReadEEPROM(self, sizeBytes, + readData8Func, + addrSetter, + initFunc = lambda: None, + exitFunc = lambda: None): + return self.simpleRead("EEPROM", sizeBytes, readData8Func, + addrSetter, initFunc, exitFunc) + + def simpleTest(self, readFunc, writeFunc, size): + """Simple Unit-test.""" + image = genRandomBlob(size) + writeFunc(image) + if readFunc() != image: + self.chip.throwError("Unit-test failed. " + "The chip may be physically broken.") -- cgit v1.2.3