From e437784362098ebe71e6c61703ca083ad9f40c50 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sat, 15 Jan 2011 23:42:39 +0100 Subject: Add common chip shutdown implementation Signed-off-by: Michael Buesch --- README-DEVELOPERS.lyx | 8 +- README-DEVELOPERS.ps | 309 +++++++++++++++++----------------- libtoprammer/chip.py | 11 +- libtoprammer/chip_at89c2051dip20.py | 15 +- libtoprammer/chip_atmega_common.py | 8 - libtoprammer/chip_attiny13dip8.py | 7 - libtoprammer/chip_generic_sram.py | 5 +- libtoprammer/chip_m24cxxdip8.py | 8 - libtoprammer/chip_m2764a.py | 13 +- libtoprammer/chip_m8cissp.py | 10 +- libtoprammer/chip_unitest.py | 20 +-- libtoprammer/chip_w29ee011dip32.py | 17 -- libtoprammer/toprammer_main.py | 2 - tests/run-tests.sh | 10 ++ tests/top2049/001-atmega32dip40.test | 22 ++- tests/top2049/001-atmega88dip28.test | 22 ++- tests/top2049/001-atmega8dip28.test | 22 ++- tests/top2049/001-attiny13dip8.test | 22 ++- tests/top2049/002-at89c2051dip20.test | 10 +- tests/top2049/003-w29ee011dip32.test | 8 +- tests/top2049/004-hm62256dip28.test | 6 +- tests/top2049/005-m24c08.test | 6 +- toprammer | 5 +- toprammer-gui | 3 +- 24 files changed, 245 insertions(+), 324 deletions(-) diff --git a/README-DEVELOPERS.lyx b/README-DEVELOPERS.lyx index 40581ca..1829529 100644 --- a/README-DEVELOPERS.lyx +++ b/README-DEVELOPERS.lyx @@ -468,14 +468,10 @@ Chip This interface consists of the following methods: \end_layout -\begin_layout Description -initializeChip() Called once on chip initialization. - Reimplement this, if required. -\end_layout - \begin_layout Description shutdownChip() Called once on chip shutdown. - Reimplement this, if required + The default implementation turns off all voltages. + There's usually no need to override that. \end_layout \begin_layout Description diff --git a/README-DEVELOPERS.ps b/README-DEVELOPERS.ps index 50073b6..e7d1235 100644 --- a/README-DEVELOPERS.ps +++ b/README-DEVELOPERS.ps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 %%Creator: dvips(k) 5.98 Copyright 2009 Radical Eye Software %%Title: README-DEVELOPERS.dvi -%%CreationDate: Sat Jan 15 22:32:49 2011 +%%CreationDate: Sat Jan 15 23:34:25 2011 %%Pages: 7 %%PageOrder: Ascend %%BoundingBox: 0 0 596 842 @@ -11,7 +11,7 @@ %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o README-DEVELOPERS.ps README-DEVELOPERS.dvi %DVIPSParameters: dpi=600 -%DVIPSSource: TeX output 2011.01.15:2226 +%DVIPSSource: TeX output 2011.01.15:2334 %%BeginProcSet: tex.pro 0 0 %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S @@ -1825,8 +1825,8 @@ F000000FE000001FC000003F8000003F8000007F000600FE000600FE000601FC000603F8 000607F8000E07F0000E0FE0000C1FC0001C1FC0001C3F80003C7F00007CFF0003FCFFFF FFFCFFFFFFFC1F247EA325>I E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fe ecbx1000 10 42 -/Fe 42 123 df<00001C00003C0000F80001F00003E00007E0000FC0001F80001F00003F +%DVIPSBitmapFont: Fe ecbx1000 10 41 +/Fe 41 122 df<00001C00003C0000F80001F00003E00007E0000FC0001F80001F00003F 00007E0000FE0000FC0001FC0001F80003F80003F80007F00007F0000FF0000FE0001FE0 001FE0001FC0003FC0003FC0003FC0003FC0007F80007F80007F80007F80007F8000FF80 00FF8000FF8000FF8000FF8000FF8000FF8000FF8000FF8000FF8000FF8000FF8000FF80 @@ -2220,12 +2220,7 @@ D121 D<3FFFFFFFC03FFFFFFFC03FFFFFFFC03FF003FF803F8007FF803F000FFF003E00 -0FFE003C001FFC007C003FFC007C003FF80078007FF0007800FFF0007800FFE0007801FF -C0007803FFC0000007FF80000007FF0000000FFE0000001FFE0000001FFC0000003FF800 -00007FF803C000FFF003C000FFE003C001FFC003C003FFC003C003FF8007C007FF0007C0 -0FFF0007C00FFE000F801FFC000F803FFC001F807FF8003F807FF001FF80FFFFFFFF80FF -FFFFFF80FFFFFFFF8022257DA42A>I E +>121 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Ff ecbx1440 14.4 42 /Ff 42 122 df<000000007FFC0000000000001FFFFF800000000001FFFFFFE000000000 @@ -3471,213 +3466,213 @@ e(not)i(sen)n(t)g(immediately)-7 b(,)29 b(but)g(queued)515 b(This)29 b(is)f(done)g(to)g(sp)r(eed)h(up)g(device)f(access)f (signi\034can)n(tly)-7 b(.)515 904 y(The)27 b(command)g(transmission)g (queue)g(has)g(sev)n(eral)f(\035ushing)h(conditions:)639 -1070 y Fc(\017)41 b Fd(Commands)18 b(can)g(b)r(e)h(\035ushed)f +1063 y Fc(\017)41 b Fd(Commands)18 b(can)g(b)r(e)h(\035ushed)f (explicitely)h(using)f(the)g(\020\035ushCommands\(\)\021)25 -b(metho)r(d)722 1170 y(of)j(\020class)e(TOP\021.)639 -1336 y Fc(\017)41 b Fd(Commands)18 b(are)g(automatically)f(\035ushed)i +b(metho)r(d)722 1163 y(of)j(\020class)e(TOP\021.)639 +1325 y Fc(\017)41 b Fd(Commands)18 b(are)g(automatically)f(\035ushed)i (on)g(cmdReadBu\033erReg\(\))f(b)r(efore)g(read-)722 -1435 y(ing)30 b(the)h(data)f(from)g(the)h(device.)45 +1425 y(ing)30 b(the)h(data)f(from)g(the)h(device.)45 b(This)30 b(is)g(to)g(ensure)g(sequen)n(tial)g(consistency)f(of)722 -1535 y(the)f(commands.)639 1701 y Fc(\017)41 b Fd(Commands)27 +1524 y(the)f(commands.)639 1687 y Fc(\017)41 b Fd(Commands)27 b(are)g(\035ushed)h(on)f(v)-5 b(arious)26 b(v)n(oltage-la)n(y)n(out)e -(op)r(erations.)515 1867 y(Y)-7 b(ou)27 b(usually)g(do)h(not)f(need)h -(to)f(\035ush)h(commands)f(explicitely)-7 b(.)515 2142 +(op)r(erations.)515 1846 y(Y)-7 b(ou)27 b(usually)g(do)h(not)f(need)h +(to)f(\035ush)h(commands)f(explicitely)-7 b(.)515 2119 y Ff(5)131 b(Implemen)l(ting)44 b(a)g(new)f(c)l(hip)j(\(DUT\))e -(algorithm)515 2324 y Fd(The)32 b(reading)f(and)g(programming)f +(algorithm)515 2300 y Fd(The)32 b(reading)f(and)g(programming)f (algorithms)h(for)g(the)i(c)n(hips)e(\(DUT)-7 b(s\))33 -b(are)e(separated)515 2423 y(in)n(to)c(t)n(w)n(o)g(parts:)639 -2589 y Fc(\017)41 b Fd(Lo)n(w)27 b(lev)n(el)g(FPGA)i(b)r(ottom-half)639 -2755 y Fc(\017)41 b Fd(High)28 b(lev)n(el)f(Python)h(co)r(de)f -(top-half)515 2921 y(The)35 b(FPGA)i(b)r(ottom-half)f(implemen)n(ts)f +b(are)e(separated)515 2400 y(in)n(to)c(t)n(w)n(o)g(parts:)639 +2559 y Fc(\017)41 b Fd(Lo)n(w)27 b(lev)n(el)g(FPGA)i(b)r(ottom-half)639 +2721 y Fc(\017)41 b Fd(High)28 b(lev)n(el)f(Python)h(co)r(de)f +(top-half)515 2880 y(The)35 b(FPGA)i(b)r(ottom-half)f(implemen)n(ts)f (the)h(basic)f(op)r(erations)g(\(fetc)n(hing)g(data)g(from)515 -3021 y(DUT.)27 b(W)-7 b(riting)26 b(data)g(to)g(DUT.)h(etc...\).)37 +2980 y(DUT.)27 b(W)-7 b(riting)26 b(data)g(to)g(DUT.)h(etc...\).)37 b(It)27 b(ma)n(y)f(also)f(implemen)n(t)i(timingcritical)f(parts)515 -3121 y(of)e(the)h(algorithm.)34 b(Ev)n(erything)24 b(else)g(is)g +3079 y(of)e(the)h(algorithm.)34 b(Ev)n(erything)24 b(else)g(is)g (implemen)n(ted)h(in)f(the)h(high)f(lev)n(el)g(Python)g(co)r(de,)515 -3220 y(that)k(liv)n(es)e(on)i(the)g(other)f(end)g(of)h(the)g(USB)g -(line.)515 3453 y Fb(5.1)112 b(Python)37 b(top-half)h(implemen)m -(tation)515 3606 y Fd(The)27 b(DUT)i(sp)r(eci\034c)e(top-half)h(liv)n +3179 y(that)k(liv)n(es)e(on)i(the)g(other)f(end)g(of)h(the)g(USB)g +(line.)515 3410 y Fb(5.1)112 b(Python)37 b(top-half)h(implemen)m +(tation)515 3563 y Fd(The)27 b(DUT)i(sp)r(eci\034c)e(top-half)h(liv)n (es)f(in)h(the)g(\020c)n(hip_xxx.p)n(y\021)k(\034les,)c(where)f(xxx)g -(is)h(the)g(ID)515 3705 y(of)23 b(the)h(DUT.)h(This)e(\034le)h(con)n +(is)h(the)g(ID)515 3663 y(of)23 b(the)h(DUT.)h(This)e(\034le)h(con)n (tains)f(a)g(class)g(deriv)n(ed)g(from)g(the)h(\020Chip\021)30 -b(class.)35 b(The)24 b(\020Chip\021)515 3805 y(class)g(pro)n(vides)g +b(class.)35 b(The)24 b(\020Chip\021)515 3762 y(class)g(pro)n(vides)g (some)h(basic)g(help)r(er)g(metho)r(ds)h(for)f(algorithm)f(implemen)n -(tation.)36 b(It)26 b(also)515 3905 y(de\034nes)h(the)h(in)n(terface)f +(tation.)36 b(It)26 b(also)515 3862 y(de\034nes)h(the)h(in)n(terface)f (that)h(is)f(to)h(b)r(e)f(re-implemen)n(ted)h(in)f(the)h(deriv)n(ed)f -(sub)r(class.)36 b(This)515 4004 y(in)n(terface)27 b(consists)f(of)i -(the)g(follo)n(wing)e(metho)r(ds:)515 4170 y Fe(initializeChip\(\))39 -b Fd(Called)34 b(once)g(on)h(c)n(hip)f(initialization.)57 -b(Reimplemen)n(t)35 b(this,)i(if)e(re-)722 4270 y(quired.)515 -4436 y Fe(sh)m(utdo)m(wnChip\(\))41 b Fd(Called)19 b(once)f(on)h(c)n -(hip)f(sh)n(utdo)n(wn.)34 b(Reimplemen)n(t)19 b(this,)i(if)e(required) -515 4602 y Fe(readSignature\(\))42 b Fd(Read)31 b(the)i(DUT)f -(signature)f(and)g(return)h(it.)49 b(Reimplemen)n(t)33 -b(this,)722 4702 y(if)28 b(y)n(our)f(DUT)h(supp)r(orts)f(signature)f -(reading.)515 4868 y 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 4967 y(erasing.)1926 5255 y(4)p eop end +(sub)r(class.)36 b(This)515 3962 y(in)n(terface)27 b(consists)f(of)i +(the)g(follo)n(wing)e(metho)r(ds:)515 4120 y Fe(sh)m(utdo)m(wnChip\(\)) +41 b Fd(Called)26 b(once)f(on)g(c)n(hip)h(sh)n(utdo)n(wn.)35 +b(The)26 b(default)g(implemen)n(tation)722 4220 y(turns)i(o\033)f(all)h +(v)n(oltages.)34 b(There's)27 b(usually)g(no)h(need)f(to)h(o)n(v)n +(erride)d(that.)515 4382 y Fe(readSignature\(\))42 b +Fd(Read)31 b(the)i(DUT)f(signature)f(and)g(return)h(it.)49 +b(Reimplemen)n(t)33 b(this,)722 4482 y(if)28 b(y)n(our)f(DUT)h(supp)r +(orts)f(signature)f(reading.)515 4645 y 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 4744 y(erasing.)515 4907 +y Fe(readProgmem\(\))h Fd(Read)22 b(the)g(program)e(memory)h(and)h +(return)g(it.)35 b(Reimplemen)n(t)23 b(this,)722 5006 +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.)1926 5255 y(4)p eop end %%Page: 5 5 -TeXDict begin 5 4 bop 515 523 a 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 623 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 -789 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 888 y(y)n(our)27 b(DUT)h(has)f(program)e(memory)i(and) -g(supp)r(orts)h(writing)f(it.)515 1054 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 1154 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 -1320 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 -1420 y(DUT)h(has)e(\(E\)EPR)n(OM)i(memory)d(and)i(supp)r(orts)f -(writing)g(it.)515 1586 y Fe(readF)-8 b(use\(\))42 b +TeXDict begin 5 4 bop 515 523 a 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 623 y(y)n(our)27 +b(DUT)h(has)f(program)e(memory)i(and)g(supp)r(orts)h(writing)f(it.)515 +774 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 +874 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 1025 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 +1125 y(DUT)h(has)e(\(E\)EPR)n(OM)i(memory)d(and)i(supp)r(orts)f +(writing)g(it.)515 1276 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 1685 y(DUT)d(has)e(F)-7 -b(uses)27 b(and)g(supp)r(orts)g(reading)g(them.)515 1851 +b(Reimplemen)n(t)33 b(this,)g(if)f(y)n(our)722 1375 y(DUT)d(has)e(F)-7 +b(uses)27 b(and)g(supp)r(orts)g(reading)g(them.)515 1527 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 1951 y(and)28 b(supp)r(orts)f(writing)g -(them.)515 2117 y Fe(readLo)s(c)m(kbits\(\))42 b Fd(Read)31 +f(DUT)i(has)e(F)-7 b(uses)722 1626 y(and)28 b(supp)r(orts)f(writing)g +(them.)515 1778 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 2217 y(if)c(y)n(our)f(DUT)h(has)f(Lo)r +b(Reimplemen)n(t)32 b(this,)722 1877 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 -2383 y Fe(writeLo)s(c)m(kbits\(\))41 b Fd(W)-7 b(rite)30 +2029 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 2482 y(has)g(Lo)r(c)n(kbits)g(and)h -(supp)r(orts)f(writing)g(them.)515 2648 y(After)f(de\034ning)g(y)n(our) +b(this,)h(if)g(y)n(our)d(DUT)722 2128 y(has)g(Lo)r(c)n(kbits)g(and)h +(supp)r(orts)f(writing)g(them.)515 2265 y(After)f(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 2748 y(de\034ning)i(a)g -(ChipDescription\(\):)722 3030 y Fa(ChipDescription\(C)o(hi)o(p_)o(MyD) +(it.)36 b(This)26 b(is)g(done)f(b)n(y)515 2365 y(de\034ning)i(a)g +(ChipDescription\(\):)722 2610 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 3213 y Fd(The)39 +b(chipID)j(=)j(\020myChipID\021\))515 2756 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 3313 y(ID)33 +(as)h(\034rst)f(parameter.)70 b(The)515 2855 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 3412 +(parameter.)50 b(A)33 b(c)n(hipID)g(migh)n(t)515 2955 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 -3512 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 3611 y(do)r(cumen)n -(tation)27 b(for)g(details.)515 3844 y Fb(5.2)112 b(FPGA)37 -b(b)s(ottom-half)g(implemen)m(tation)515 3997 y Fd(F)-7 +3055 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 3154 y(do)r(cumen)n +(tation)27 b(for)g(details.)515 3380 y Fb(5.2)112 b(FPGA)37 +b(b)s(ottom-half)g(implemen)m(tation)515 3534 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 -4097 y(10.1)d(service)g(pac)n(k)h(3.)36 b(The)26 b("W)-7 +3633 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 4196 y(b)r(e)j(do)n(wnloaded)e(for)h(free)g +(purp)r(oses,)f(can)515 3733 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 -4379 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 4562 y Fd(T)-7 b(o)24 +3879 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 4024 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 4661 +(new)g(c)n(hip,)h(go)e(to)i(the)f(libtopram-)515 4124 y(mer/bit/src/)h(sub)r(directory)i(and)g(execute)g(the)h("create.sh")e -(script:)722 4844 y Fa(./create.sh)39 b(name_of_chip)1926 -5255 y Fd(5)p eop end +(script:)722 4270 y Fa(./create.sh)39 b(name_of_chip)515 +4416 y Fd(Where)34 b("name_of_c)n(hip")e(is)j(the)g(name)f(of)h(the)g +(new)g(c)n(hip.)58 b(No)n(w)34 b(go)g(to)g(libtopram-)515 +4515 y(mer/bit/src/name_of_c)n(hip/)27 b(and)32 b(implemen)n(t)g(the)g +(b)r(ottom-half)g(algorithm)f(in)h(the)515 4615 y(name_of_c)n(hip.v)f +(V)-7 b(erilog)32 b(\034le.)53 b(T)-7 b(o)32 b(build)i(the)f(.BIT)g +(\034le)g(from)f(the)i(V)-7 b(erilog)32 b(sources,)515 +4715 y(go)26 b(to)i(the)g(libtoprammer/bit/)e(directory)g(and)h +(execute:)722 4860 y Fa(./build.sh)40 b(name_of_chip)515 +5006 y Fd(\(if)28 b(y)n(ou)f(omit)h(the)f(c)n(hipname,)h(all)f(c)n +(hips)g(will)h(b)r(e)g(rebuilt\).)1926 5255 y(5)p eop +end %%Page: 6 6 -TeXDict begin 6 5 bop 515 523 a Fd(Where)34 b("name_of_c)n(hip")e(is)j -(the)g(name)f(of)h(the)g(new)g(c)n(hip.)58 b(No)n(w)34 -b(go)g(to)g(libtopram-)515 623 y(mer/bit/src/name_of_c)n(hip/)27 -b(and)32 b(implemen)n(t)g(the)g(b)r(ottom-half)g(algorithm)f(in)h(the) -515 722 y(name_of_c)n(hip.v)f(V)-7 b(erilog)32 b(\034le.)53 -b(T)-7 b(o)32 b(build)i(the)f(.BIT)g(\034le)g(from)f(the)i(V)-7 -b(erilog)32 b(sources,)515 822 y(go)26 b(to)i(the)g(libtoprammer/bit/)e -(directory)g(and)h(execute:)722 993 y Fa(./build.sh)40 -b(name_of_chip)515 1164 y Fd(\(if)28 b(y)n(ou)f(omit)h(the)f(c)n -(hipname,)h(all)f(c)n(hips)g(will)h(b)r(e)g(rebuilt\).)515 -1436 y Ff(6)131 b(Automatic)44 b(la)l(y)l(out)h(generator)515 -1618 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 -1718 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 -1818 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 1917 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 2017 -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 -2116 y(programmers)g(and)i(it)h(is)g(m)n(uc)n(h)f(easier)g(to)g -(implemen)n(t.)41 b(Y)-7 b(ou)29 b(do)g(not)f(ha)n(v)n(e)g(to)g(searc)n -(h)f(a)515 2216 y(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)f(device)g(constrain)n(ts.)36 -b(The)27 b(autogener-)515 2316 y(ator)f(will)i(do)f(it)h(for)f(y)n(ou.) -639 2415 y(The)20 b(c)n(hip)g(in)n(terface)f(of)h(the)g(autogenerator)e +TeXDict begin 6 5 bop 515 523 a Ff(6)131 b(Automatic)44 +b(la)l(y)l(out)h(generator)515 705 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 804 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 904 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 1004 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 1103 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 1203 y(programmers)g(and)i(it)h(is)g(m)n(uc)n(h)f(easier)g +(to)g(implemen)n(t.)41 b(Y)-7 b(ou)29 b(do)g(not)f(ha)n(v)n(e)g(to)g +(searc)n(h)f(a)515 1303 y(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)f(device)g(constrain)n(ts.)36 +b(The)27 b(autogener-)515 1402 y(ator)f(will)i(do)f(it)h(for)f(y)n(ou.) +639 1502 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 2515 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 1601 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 2615 +b(.)39 b(Y)-7 b(ou'll)28 b(do)g(it)h(through)515 1701 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 -2714 y(The)j(constructor)e(\(__init__\(\)\))h(has)g(some)g -(autogenerator)e(related)i(parameters:)515 2871 y Fe(c)m(hipP)m(ac)m(k) +1801 y(The)j(constructor)e(\(__init__\(\)\))h(has)g(some)g +(autogenerator)e(related)i(parameters:)515 1967 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 -2971 y(DUT)26 b(c)n(hip.)36 b(It)25 b(is)g(something)g(lik)n(e)f +2066 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 3070 y(eter)i(is)f(passed)g(to)g(the)h +b(.)f(If)25 b(this)h(param-)722 2166 y(eter)i(is)f(passed)g(to)g(the)h (constructor,)e(the)i(autogenerator)d(is)i(enabled.)515 -3232 y Fe(c)m(hipPin)-8 b(V)m(CCX)42 b Fd(This)34 b(parameter)e(is)i +2332 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 -3331 y(c)n(hip)26 b(pac)n(k)-5 b(age.)35 b(Note)26 b(that)g(it)h(sp)r +2432 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 3431 y(_not_)h(on)g(the)g(ZIF)h(so)r(c)n(k)n(et.)35 +b(age)24 b(and)722 2531 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 3530 y(on)j(pin)g(8,)f(y)n(ou)g(pass)f(an)i(8)f(here.) -515 3692 y Fe(c)m(hipPinsVPP)42 b Fd(This)27 b(parameter)e(is)i(an)f +(V)n(CC)f(is)722 2631 y(on)j(pin)g(8,)f(y)n(ou)g(pass)f(an)i(8)f(here.) +515 2797 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 3791 y(VPP)34 b(pin\(s\))f(on)f(the)h(c)n(hip)f(pac)n(k)-5 +722 2897 y(VPP)34 b(pin\(s\))f(on)f(the)h(c)n(hip)f(pac)n(k)-5 b(age.)49 b(Note)32 b(that)h(it)g(sp)r(eci\034es)f(the)h(V)n(CC)f(pin)g -(on)722 3891 y(the)27 b(c)n(hip)f(pac)n(k)-5 b(age)24 +(on)722 2996 y(the)27 b(c)n(hip)f(pac)n(k)-5 b(age)24 b(and)i(_not_)g(on)f(the)i(ZIF)f(so)r(c)n(k)n(et.)35 -b(So)26 b(if)h(y)n(our)e(c)n(hip)h(datasheet)722 3991 +b(So)26 b(if)h(y)n(our)e(c)n(hip)h(datasheet)722 3096 y(tells)35 b(y)n(ou)e(that)h(V)n(CC)g(is)g(on)g(pin)h(1,)g(y)n(ou)f (pass)f(an)h(1)g(here.)56 b(If)34 b(y)n(our)f(c)n(hip)h(needs)722 -4090 y(m)n(ultiple)d(VPP)h(v)n(oltages,)d(just)i(pass)f(a)g(list)h(of)f +3196 y(m)n(ultiple)d(VPP)h(v)n(oltages,)d(just)i(pass)f(a)g(list)h(of)f (pins.)46 b(Sp)r(ecify)31 b(all)f(p)r(ossible)g(VPP)722 -4190 y(pins)25 b(here.)35 b(Whic)n(h)25 b(pin)g(is)g(actually)e(activ) +3295 y(pins)25 b(here.)35 b(Whic)n(h)25 b(pin)g(is)g(actually)e(activ) -5 b(ated)25 b(is)f(decided)h(later)f(in)h(applyVPP\(\).)515 -4351 y Fe(c)m(hipPinGND)41 b Fd(This)d(parameter)e(is)i(an)g(in)n +3461 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 -4451 y(c)n(hip)26 b(pac)n(k)-5 b(age.)35 b(Note)26 b(that)g(it)h(sp)r +3561 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 4551 y(_not_)h(on)g(the)g(ZIF)h(so)r(c)n(k)n(et.)35 +b(age)24 b(and)722 3660 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 4650 y(on)j(pin)g(5,)f(y)n(ou)g(pass)f(an)i(5)f(here.) -515 4807 y(After)h(passing)e(all)h(parameters)f(to)h(the)h(\020class)e +(V)n(CC)f(is)722 3760 y(on)j(pin)g(5,)f(y)n(ou)g(pass)f(an)i(5)f(here.) +515 3926 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 -4907 y(is)c(initialized)h(and)f(ready)g(to)g(b)r(e)h(used.)36 +4026 y(is)c(initialized)h(and)f(ready)g(to)g(b)r(e)h(used.)36 b(The)24 b(follo)n(wing)g(metho)r(ds)g(can)h(b)r(e)g(used)f(to)g(apply) -515 5006 y(or)i(disable)i(a)f(la)n(y)n(out:)1926 5255 -y(6)p eop end +515 4125 y(or)i(disable)i(a)f(la)n(y)n(out:)515 4291 +y Fe(applyV)m(CCX\(on\))42 b Fd(This)27 b(metho)r(d)h(enables)f(or)f +(disables)g(\(dep)r(ending)i(on)f(the)h(param-)722 4391 +y(eter\))37 b(a)f(la)n(y)n(out.)63 b(Enabling)37 b(the)g(la)n(y)n(out)f +(means)g(that)h(the)g(V)n(CCX)g(pin)g(will)g(b)r(e)722 +4491 y(activ)n(ely)22 b(driv)n(en)h(b)n(y)f(the)i(con\034gured)d(V)n +(CCX)j(v)n(oltage.)33 b(Disabling)23 b(the)g(la)n(y)n(out)f(will)722 +4590 y(tristate)27 b(the)h(driv)n(er.)515 4756 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 4856 y(p)r(ending)29 b(on)e(the)i +(parameter\))d(a)i(la)n(y)n(out.)37 b(Enabling)28 b(the)g(la)n(y)n(out) +f(means)g(that)i(the)722 4956 y(VPP)22 b(pins)f(will)f(b)r(e)h(activ)n +(ely)f(driv)n(en)g(b)n(y)g(the)h(con\034gured)e(VPP)j(v)n(oltage.)32 +b(Disabling)1926 5255 y(6)p eop end %%Page: 7 7 -TeXDict begin 7 6 bop 515 523 a Fe(applyV)m(CCX\(on\))42 -b Fd(This)27 b(metho)r(d)h(enables)f(or)f(disables)g(\(dep)r(ending)i -(on)f(the)h(param-)722 623 y(eter\))37 b(a)f(la)n(y)n(out.)63 -b(Enabling)37 b(the)g(la)n(y)n(out)f(means)g(that)h(the)g(V)n(CCX)g -(pin)g(will)g(b)r(e)722 722 y(activ)n(ely)22 b(driv)n(en)h(b)n(y)f(the) -i(con\034gured)d(V)n(CCX)j(v)n(oltage.)33 b(Disabling)23 -b(the)g(la)n(y)n(out)f(will)722 822 y(tristate)27 b(the)h(driv)n(er.) -515 988 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 -1088 y(p)r(ending)29 b(on)e(the)i(parameter\))d(a)i(la)n(y)n(out.)37 -b(Enabling)28 b(the)g(la)n(y)n(out)f(means)g(that)i(the)722 -1187 y(VPP)22 b(pins)f(will)f(b)r(e)h(activ)n(ely)f(driv)n(en)g(b)n(y)g -(the)h(con\034gured)e(VPP)j(v)n(oltage.)32 b(Disabling)722 -1287 y(the)g(la)n(y)n(out)d(will)j(tristate)e(the)i(driv)n(er.)46 -b(The)31 b(\034rst)g(parameter)e(\020on\021)37 b(is)31 -b(a)g(b)r(o)r(olean)722 1386 y(to)24 b(turn)g(ON)g(or)f(OFF)h(the)g -(VPP)h(la)n(y)n(out.)35 b(The)24 b(second)f(parameter)f(is)i(an)g -(optional)722 1486 y(list)f(of)g(pac)n(k)-5 b(age-pin-n)n(um)n(b)r(ers) -21 b(sp)r(ecifying)h(whic)n(h)h(VPP)h(is)f(turned)g(on.)35 -b(If)24 b(the)f(sec-)722 1586 y(ond)28 b(parameter)e(is)h(not)g -(passed,)g(all)g(p)r(ossible)g(VPPs)i(that)f(w)n(ere)e(sp)r(eci\034ed)i -(in)g(the)722 1685 y(constructor)21 b(are)h(turned)h(on.)34 +TeXDict begin 7 6 bop 722 523 a Fd(the)32 b(la)n(y)n(out)d(will)j +(tristate)e(the)i(driv)n(er.)46 b(The)31 b(\034rst)g(parameter)e +(\020on\021)37 b(is)31 b(a)g(b)r(o)r(olean)722 623 y(to)24 +b(turn)g(ON)g(or)f(OFF)h(the)g(VPP)h(la)n(y)n(out.)35 +b(The)24 b(second)f(parameter)f(is)i(an)g(optional)722 +722 y(list)f(of)g(pac)n(k)-5 b(age-pin-n)n(um)n(b)r(ers)21 +b(sp)r(ecifying)h(whic)n(h)h(VPP)h(is)f(turned)g(on.)35 +b(If)24 b(the)f(sec-)722 822 y(ond)28 b(parameter)e(is)h(not)g(passed,) +g(all)g(p)r(ossible)g(VPPs)i(that)f(w)n(ere)e(sp)r(eci\034ed)i(in)g +(the)722 922 y(constructor)21 b(are)h(turned)h(on.)34 b(The)23 b(second)f(parameter)f(is)h(un)n(used,)i(if)f(\020on=F)-7 -b(alse\021.)515 1851 y Fe(applyGND\(on\))42 b Fd(This)34 +b(alse\021.)515 1088 y Fe(applyGND\(on\))42 b Fd(This)34 b(metho)r(d)g(enables)g(or)g(disables)f(\(dep)r(ending)i(on)f(the)h -(param-)722 1951 y(eter\))j(a)g(la)n(y)n(out.)67 b(Enabling)38 +(param-)722 1187 y(eter\))j(a)g(la)n(y)n(out.)67 b(Enabling)38 b(the)g(la)n(y)n(out)f(means)h(that)g(the)g(GND)h(pins)f(will)h(b)r(e) -722 2051 y(activ)n(ely)27 b(driv)n(en)g(b)n(y)g(GND.)i(Disabling)e(the) +722 1287 y(activ)n(ely)27 b(driv)n(en)g(b)n(y)g(GND.)i(Disabling)e(the) h(la)n(y)n(out)e(will)i(tristate)f(the)h(driv)n(er.)1926 5255 y(7)p eop end %%Trailer diff --git a/libtoprammer/chip.py b/libtoprammer/chip.py index b5f9648..554ecdc 100644 --- a/libtoprammer/chip.py +++ b/libtoprammer/chip.py @@ -185,11 +185,14 @@ class Chip: self.top.progressMeter(AbstractUserInterface.PROGRESSMETER_CHIPACCESS, step) - def initializeChip(self): - pass # Override me in the subclass, if required. - def shutdownChip(self): - pass # Override me in the subclass, if required. + # 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()) def readSignature(self): # Override me in the subclass, if required. diff --git a/libtoprammer/chip_at89c2051dip20.py b/libtoprammer/chip_at89c2051dip20.py index e1026fb..04c006d 100644 --- a/libtoprammer/chip_at89c2051dip20.py +++ b/libtoprammer/chip_at89c2051dip20.py @@ -35,23 +35,15 @@ class Chip_AT89C2051dip20(Chip): chipPinsVPP = 1, chipPinGND = 10) - def initializeChip(self): - self.printDebug("Initializing chip") + def __initChip(self): self.applyVCCX(False) self.applyVPP(False) self.applyGND(True) self.top.cmdSetVCCXVoltage(5) self.top.cmdSetVPPVoltage(5) - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(0) - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - def readSignature(self): + self.__initChip() self.applyGND(True) self.applyVCCX(True) self.top.cmdSetVPPVoltage(5) @@ -76,6 +68,7 @@ class Chip_AT89C2051dip20(Chip): return signature def erase(self): + self.__initChip() self.applyGND(True) self.applyVCCX(True) self.__loadCommand(1) # set P3.2 @@ -98,6 +91,7 @@ class Chip_AT89C2051dip20(Chip): self.top.printInfo("at89c2051dip20: Erase failed!") def readProgmem(self): + self.__initChip() self.applyGND(True) self.applyVCCX(True) self.__loadCommand(1) # set P3.2 @@ -130,6 +124,7 @@ class Chip_AT89C2051dip20(Chip): if len(image) > 0x800: self.throwError("Invalid EPROM image size %d (expected <=%d)" %\ (len(image), 0x800)) + self.__initChip() self.applyGND(True) self.applyVCCX(True) self.__loadCommand(1) # set P3.2 diff --git a/libtoprammer/chip_atmega_common.py b/libtoprammer/chip_atmega_common.py index 3918ab9..9af4861 100644 --- a/libtoprammer/chip_atmega_common.py +++ b/libtoprammer/chip_atmega_common.py @@ -52,14 +52,6 @@ class Chip_ATMega_common(Chip): self.eepromPageSize = eepromPageSize # EEPROM page size, in bytes self.eepromPages = eepromPages # Nr of EEPROM pages - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(5) - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - def readSignature(self): self.__enterPM() diff --git a/libtoprammer/chip_attiny13dip8.py b/libtoprammer/chip_attiny13dip8.py index e399334..8aea8d8 100644 --- a/libtoprammer/chip_attiny13dip8.py +++ b/libtoprammer/chip_attiny13dip8.py @@ -41,13 +41,6 @@ class Chip_AtTiny13dip8(Chip): self.eepromPageSize = 4 self.eepromPages = 16 - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.top.cmdSetVPPVoltage(5) - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - def readSignature(self): self.__enterPM() self.progressMeterInit("Reading signature", 0) diff --git a/libtoprammer/chip_generic_sram.py b/libtoprammer/chip_generic_sram.py index 1770338..9f7b8f8 100644 --- a/libtoprammer/chip_generic_sram.py +++ b/libtoprammer/chip_generic_sram.py @@ -39,10 +39,11 @@ class Chip_genericSRAM(Chip): def shutdownChip(self): self.printDebug("Shutdown chip") + # Keep it powered up self.top.cmdSetVCCXVoltage(self.VCCXVoltage) - self.applyVCCX(False) + self.applyVCCX(True) self.applyVPP(False) - self.applyGND(False) + self.applyGND(True) def erase(self): self.writeRAM(chr(0) * self.__sizeBytes()) diff --git a/libtoprammer/chip_m24cxxdip8.py b/libtoprammer/chip_m24cxxdip8.py index fa73553..c8b4af5 100644 --- a/libtoprammer/chip_m24cxxdip8.py +++ b/libtoprammer/chip_m24cxxdip8.py @@ -39,14 +39,6 @@ class Chip_m24cXXdip8_common(Chip): chipPinGND = 4) self.eepromSize = eepromSize # in bytes - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(5) - def __chipTurnOn(self): self.top.cmdSetVCCXVoltage(5) self.top.cmdSetVPPVoltage(5) diff --git a/libtoprammer/chip_m2764a.py b/libtoprammer/chip_m2764a.py index 30cc4cc..9d23c2b 100644 --- a/libtoprammer/chip_m2764a.py +++ b/libtoprammer/chip_m2764a.py @@ -35,8 +35,7 @@ class Chip_M2764A(Chip): chipPinsVPP = 1, chipPinGND = 14) - def initializeChip(self): - self.printDebug("Initializing chip") + def __initChip(self): self.applyVCCX(False) self.applyVPP(False) self.applyGND(False) @@ -44,15 +43,8 @@ class Chip_M2764A(Chip): self.top.cmdSetVPPVoltage(0) self.top.cmdSetVPPVoltage(5) - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(5) - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - def readEEPROM(self): + self.__initChip() self.top.cmdSetVCCXVoltage(5) self.top.cmdSetVPPVoltage(5) self.applyVCCX(True) @@ -81,6 +73,7 @@ class Chip_M2764A(Chip): self.throwError("Invalid EPROM image size %d (expected <=%d)" %\ (len(image), 0x2000)) + self.__initChip() self.top.cmdSetVCCXVoltage(5) self.top.cmdSetVPPVoltage(12) self.applyVCCX(True) diff --git a/libtoprammer/chip_m8cissp.py b/libtoprammer/chip_m8cissp.py index b64a3c0..70178b1 100644 --- a/libtoprammer/chip_m8cissp.py +++ b/libtoprammer/chip_m8cissp.py @@ -173,7 +173,7 @@ class Chip_M8C_ISSP(Chip): def __init__(self): Chip.__init__(self) - def initializeChip(self): + def initializeChip(self): #FIXME put somewhere else self.printDebug("Initializing chip") self.top.vccx.setLayoutMask(0) self.top.vpp.setLayoutMask(0) @@ -187,14 +187,6 @@ class Chip_M8C_ISSP(Chip): id = self.__readID() print "ID=0x%04X" % id - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(5) - self.top.vccx.setLayoutMask(0) - self.top.vpp.setLayoutMask(0) - self.top.gnd.setLayoutPins( [] ) - def __powerDown(self): "Turn the power to the device off" self.printDebug("Powering device down...") diff --git a/libtoprammer/chip_unitest.py b/libtoprammer/chip_unitest.py index d54ad71..9ca434a 100644 --- a/libtoprammer/chip_unitest.py +++ b/libtoprammer/chip_unitest.py @@ -27,15 +27,11 @@ class Chip_Unitest(Chip): def __init__(self): Chip.__init__(self) - def initializeChip(self): - self.printDebug("Initializing chip") - self.__reset() - def shutdownChip(self): self.printDebug("Shutdown chip") - self.__reset() + self.reset() - def __reset(self): + def reset(self): self.top.vccx.setLayoutPins( [] ) self.vccxMask = 0 self.top.vpp.setLayoutPins( [] ) @@ -110,12 +106,12 @@ class Chip_Unitest(Chip): self.__updateOut() def getInputs(self): - self.top.cmdFPGAReadRaw(0x30) - self.top.cmdFPGAReadRaw(0x31) - self.top.cmdFPGAReadRaw(0x32) - self.top.cmdFPGAReadRaw(0x33) - self.top.cmdFPGAReadRaw(0x34) - self.top.cmdFPGAReadRaw(0x35) + self.top.cmdFPGARead(0x30) + self.top.cmdFPGARead(0x31) + self.top.cmdFPGARead(0x32) + self.top.cmdFPGARead(0x33) + self.top.cmdFPGARead(0x34) + self.top.cmdFPGARead(0x35) inputs = self.top.cmdReadBufferReg48() return inputs diff --git a/libtoprammer/chip_w29ee011dip32.py b/libtoprammer/chip_w29ee011dip32.py index 739c690..9c1b912 100644 --- a/libtoprammer/chip_w29ee011dip32.py +++ b/libtoprammer/chip_w29ee011dip32.py @@ -36,23 +36,6 @@ class Chip_w29ee011dip32(Chip): chipPinsVPP = None, chipPinGND = 16) - def initializeChip(self): - self.printDebug("Initializing chip") - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(0) - self.top.cmdSetVPPVoltage(5) - - def shutdownChip(self): - self.printDebug("Shutdown chip") - self.top.cmdSetVCCXVoltage(5) - self.top.cmdSetVPPVoltage(5) - self.applyVCCX(False) - self.applyVPP(False) - self.applyGND(False) - def erase(self): self.applyVCCX(True) self.applyVPP(True) diff --git a/libtoprammer/toprammer_main.py b/libtoprammer/toprammer_main.py index 861da70..3d6ddbd 100644 --- a/libtoprammer/toprammer_main.py +++ b/libtoprammer/toprammer_main.py @@ -105,7 +105,6 @@ class TOP: self.bitfile.parseFile(bitfile) # Initialize the hardware. self.__bitfileUpload(descriptor.runtimeID) - self.chip.initializeChip() def shutdownChip(self): if self.chip: @@ -116,7 +115,6 @@ class TOP: def resetChip(self): if self.chip: self.chip.shutdownChip() - self.chip.initializeChip() self.flushCommands() def getChip(self): diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 184698b..0e7fcb7 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -52,6 +52,9 @@ function toprammer local args="$@" local logfile="$tmpdir/toprammer.log" + [ -n "$current_chipid" ] && args="$args --chip-id $current_chipid" + args="$args -I bin -O bin" + echo " toprammer $args" cd "$basedir/.." || die "Failed to chdir" if [ $verbose -eq 0 ]; then @@ -108,6 +111,11 @@ function request function request_DUT # $1=DUT-name { local dut="$1" + + current_chipid="$dut" + # Init the programmer + toprammer --force-upload + # Show layout toprammer_layout -d "$current_device" -p "$dut" --only-insert request "Please insert a $dut into the ZIF socket (x to skip; a to abort)..." } @@ -174,6 +182,7 @@ done current_test= current_device= +current_chipid= cleanup mkdir -p "$tmpdir" [ $? -eq 0 ] || die "Failed to create $tmpdir" @@ -249,6 +258,7 @@ function do_run_test # $1=device, $2=testscript current_device= current_test= + current_chipid= } if [ $nr_scriptpaths -eq 0 ]; then diff --git a/tests/top2049/001-atmega32dip40.test b/tests/top2049/001-atmega32dip40.test index 0820421..e7c7255 100644 --- a/tests/top2049/001-atmega32dip40.test +++ b/tests/top2049/001-atmega32dip40.test @@ -8,32 +8,30 @@ function test_init function test_run { - local args="-c atmega32dip40 -I bin -O bin" - # Check signature - toprammer $args --read-sig "$tmpfile" + toprammer --read-sig "$tmpfile" compare_file_to_hex "$tmpfile" "1E9502" || die "signature mismatch" - toprammer $args --erase + toprammer --erase # Check progmem - toprammer $args --write-prog "$testfile_32k" - toprammer $args --read-prog "$tmpfile" + toprammer --write-prog "$testfile_32k" + toprammer --read-prog "$tmpfile" compare_files "$testfile_32k" "$tmpfile" || die "progmem mismatch" # Check EEPROM - toprammer $args --write-eeprom "$testfile_1k" - toprammer $args --read-eeprom "$tmpfile" + toprammer --write-eeprom "$testfile_1k" + toprammer --read-eeprom "$tmpfile" compare_files "$testfile_1k" "$tmpfile" || die "EEPROM mismatch" # Check fuses testfuses="A4D9" - echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse - - toprammer $args --read-fuse "$tmpfile" + echo "0x0000: $testfuses" | toprammer -I hex --write-fuse - + toprammer --read-fuse "$tmpfile" compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch" # Check lockbits - toprammer $args --read-lock "$tmpfile" + toprammer --read-lock "$tmpfile" compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch" - toprammer $args --write-lock "$tmpfile" + toprammer --write-lock "$tmpfile" } diff --git a/tests/top2049/001-atmega88dip28.test b/tests/top2049/001-atmega88dip28.test index 4dd6d11..2e0ca8f 100644 --- a/tests/top2049/001-atmega88dip28.test +++ b/tests/top2049/001-atmega88dip28.test @@ -8,32 +8,30 @@ function test_init function test_run { - local args="-c atmega88dip28 -I bin -O bin" - # Check signature - toprammer $args --read-sig "$tmpfile" + toprammer --read-sig "$tmpfile" compare_file_to_hex "$tmpfile" "1E930A" || die "signature mismatch" - toprammer $args --erase + toprammer --erase # Check progmem - toprammer $args --write-prog "$testfile_8k" - toprammer $args --read-prog "$tmpfile" + toprammer --write-prog "$testfile_8k" + toprammer --read-prog "$tmpfile" compare_files "$testfile_8k" "$tmpfile" || die "progmem mismatch" # Check EEPROM - toprammer $args --write-eeprom "$testfile_512" - toprammer $args --read-eeprom "$tmpfile" + toprammer --write-eeprom "$testfile_512" + toprammer --read-eeprom "$tmpfile" compare_files "$testfile_512" "$tmpfile" || die "EEPROM mismatch" # Check fuses #TODO testfuses="E1D9" -# echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse - -# toprammer $args --read-fuse "$tmpfile" +# echo "0x0000: $testfuses" | toprammer -I hex --write-fuse - +# toprammer --read-fuse "$tmpfile" # compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch" # Check lockbits - toprammer $args --read-lock "$tmpfile" + toprammer --read-lock "$tmpfile" compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch" - toprammer $args --write-lock "$tmpfile" + toprammer --write-lock "$tmpfile" } diff --git a/tests/top2049/001-atmega8dip28.test b/tests/top2049/001-atmega8dip28.test index d519adb..32133b7 100644 --- a/tests/top2049/001-atmega8dip28.test +++ b/tests/top2049/001-atmega8dip28.test @@ -8,32 +8,30 @@ function test_init function test_run { - local args="-c atmega8dip28 -I bin -O bin" - # Check signature - toprammer $args --read-sig "$tmpfile" + toprammer --read-sig "$tmpfile" compare_file_to_hex "$tmpfile" "1E9307" || die "signature mismatch" - toprammer $args --erase + toprammer --erase # Check progmem - toprammer $args --write-prog "$testfile_8k" - toprammer $args --read-prog "$tmpfile" + toprammer --write-prog "$testfile_8k" + toprammer --read-prog "$tmpfile" compare_files "$testfile_8k" "$tmpfile" || die "progmem mismatch" # Check EEPROM - toprammer $args --write-eeprom "$testfile_512" - toprammer $args --read-eeprom "$tmpfile" + toprammer --write-eeprom "$testfile_512" + toprammer --read-eeprom "$tmpfile" compare_files "$testfile_512" "$tmpfile" || die "EEPROM mismatch" # Check fuses testfuses="E1D9" - echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse - - toprammer $args --read-fuse "$tmpfile" + echo "0x0000: $testfuses" | toprammer -I hex --write-fuse - + toprammer --read-fuse "$tmpfile" compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch" # Check lockbits - toprammer $args --read-lock "$tmpfile" + toprammer --read-lock "$tmpfile" compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch" - toprammer $args --write-lock "$tmpfile" + toprammer --write-lock "$tmpfile" } diff --git a/tests/top2049/001-attiny13dip8.test b/tests/top2049/001-attiny13dip8.test index 75f12f9..4411bb9 100644 --- a/tests/top2049/001-attiny13dip8.test +++ b/tests/top2049/001-attiny13dip8.test @@ -8,32 +8,30 @@ function test_init function test_run { - local args="-c attiny13dip8 -I bin -O bin" - # Check signature - toprammer $args --read-sig "$tmpfile" + toprammer --read-sig "$tmpfile" compare_file_to_hex "$tmpfile" "1E9007" || die "signature mismatch" - toprammer $args --erase + toprammer --erase # Check progmem - toprammer $args --write-prog "$testfile_1k" - toprammer $args --read-prog "$tmpfile" + toprammer --write-prog "$testfile_1k" + toprammer --read-prog "$tmpfile" compare_files "$testfile_1k" "$tmpfile" || die "progmem mismatch" # Check EEPROM - toprammer $args --write-eeprom "$testfile_64" - toprammer $args --read-eeprom "$tmpfile" + toprammer --write-eeprom "$testfile_64" + toprammer --read-eeprom "$tmpfile" compare_files "$testfile_64" "$tmpfile" || die "EEPROM mismatch" # Check fuses testfuses="6AFF" - echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse - - toprammer $args --read-fuse "$tmpfile" + echo "0x0000: $testfuses" | toprammer -I hex --write-fuse - + toprammer --read-fuse "$tmpfile" compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch" # Check lockbits - toprammer $args --read-lock "$tmpfile" + toprammer --read-lock "$tmpfile" compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch" - toprammer $args --write-lock "$tmpfile" + toprammer --write-lock "$tmpfile" } diff --git a/tests/top2049/002-at89c2051dip20.test b/tests/top2049/002-at89c2051dip20.test index 37bc88b..40fe8fd 100644 --- a/tests/top2049/002-at89c2051dip20.test +++ b/tests/top2049/002-at89c2051dip20.test @@ -8,16 +8,14 @@ function test_init function test_run { - local args="-c at89c2051dip20 -I bin -O bin" - # Check signature - toprammer $args --read-sig "$tmpfile" + toprammer --read-sig "$tmpfile" compare_file_to_hex $tmpfile "1E21" || die "signature mismatch" - toprammer $args --erase + toprammer --erase # Check progmem - toprammer $args --write-prog "$testfile_2k" - toprammer $args --read-prog "$tmpfile" + toprammer --write-prog "$testfile_2k" + toprammer --read-prog "$tmpfile" compare_files "$testfile_2k" "$tmpfile" || die "progmem mismatch" } diff --git a/tests/top2049/003-w29ee011dip32.test b/tests/top2049/003-w29ee011dip32.test index 385960a..ad8a619 100644 --- a/tests/top2049/003-w29ee011dip32.test +++ b/tests/top2049/003-w29ee011dip32.test @@ -8,11 +8,9 @@ function test_init function test_run { - local args="-c w29ee011dip32 -I bin -O bin" + toprammer --erase - toprammer $args --erase - - toprammer $args --write-eeprom "$testfile_128k" - toprammer $args --read-eeprom "$tmpfile" + toprammer --write-eeprom "$testfile_128k" + toprammer --read-eeprom "$tmpfile" compare_files "$testfile_128k" "$tmpfile" || die "EEPROM mismatch" } diff --git a/tests/top2049/004-hm62256dip28.test b/tests/top2049/004-hm62256dip28.test index deb865c..84a7279 100644 --- a/tests/top2049/004-hm62256dip28.test +++ b/tests/top2049/004-hm62256dip28.test @@ -8,9 +8,7 @@ function test_init function test_run { - local args="-c hm62256dip28 -I bin -O bin" - - toprammer $args --write-ram "$testfile_32k" - toprammer $args --read-ram "$tmpfile" + toprammer --write-ram "$testfile_32k" + toprammer --read-ram "$tmpfile" compare_files "$testfile_32k" "$tmpfile" || die "RAM mismatch" } diff --git a/tests/top2049/005-m24c08.test b/tests/top2049/005-m24c08.test index 7c05282..89c1b7f 100644 --- a/tests/top2049/005-m24c08.test +++ b/tests/top2049/005-m24c08.test @@ -8,9 +8,7 @@ function test_init function test_run { - local args="-c m24c08dip8 -I bin -O bin" - - toprammer $args --write-eeprom "$testfile_1k" - toprammer $args --read-eeprom "$tmpfile" + toprammer --write-eeprom "$testfile_1k" + toprammer --read-eeprom "$tmpfile" compare_files "$testfile_1k" "$tmpfile" || die "EEPROM mismatch" } diff --git a/toprammer b/toprammer index dd42f07..23732db 100755 --- a/toprammer +++ b/toprammer @@ -201,9 +201,6 @@ def main(argv): if opt_action and opt_action != "print-list" and not opt_chipID: print "-c|--chip-id is mandatory!" return 1 - if not opt_action: - print "An action is mandatory!" - return 1 if not opt_informat in ("auto", "bin", "ihex", "hex"): print "Invalid -I|--in-format" return 1 @@ -246,7 +243,7 @@ def main(argv): elif opt_action == "write-ram": top.writeRAM(fileIn(opt_file, opt_informat)) else: - assert(0) + print "No action specified" top.shutdownChip() except (TOPException, BitfileException, IOError), e: print e diff --git a/toprammer-gui b/toprammer-gui index 89850ee..ad1f5d4 100755 --- a/toprammer-gui +++ b/toprammer-gui @@ -237,6 +237,7 @@ class UnitestDialog(QDialog): "unitest") if failed: raise TOPException("Failed to load 'unitest' chip: %s" % str(returnValue)) + self.queryTop("top.getChip().reset()") # Query the hardware layer for common parameters self.param_topType = self.queryTop("top.getProgrammerType()") @@ -516,7 +517,7 @@ class UnitestDialog(QDialog): HwThread.TASK_GENERICTOPCALL, taskParams) self.unblockInputPoll() if failed: - raise TOPException("Failed to query TOP %s" % funcname) + raise TOPException("Failed to query TOP %s\n%s" % (funcname, str(returnValue))) return returnValue def shutdown(self): -- cgit v1.2.3