16
LCD
(clk,start,clear,clkm:IN PUT ;
romdatai[7..0] :INPUT ; datai[7..0],mode :INPU T ; romaddro[5..0]
:OUTP UT; en,r/w,d/i,db[7..0],tmdt : OUTPUT; )
variable stks[3..0],cntp[2..0],ssk[1..0],d[1.
.0],cntd[4..0],cntm[5..0]:dff; dbnc:node;
begin stks[ ].clk=(clk); cntp[ ].clk=clk; ssk[ ].clk=clk; d[
].clk=clk; cntd[ ].clk=clk; cntm[ ].clk=clkm;
if cntm[ ]==39 then cntm[ ]=0 ; else cntm[ ]=cntm[ ]+1; end
if;
17
LCD ()
romaddro[ ]= cntm[5..0]; cntm[ ].clrn=!clear; cntd[ ].clrn=!clear;
ssk[ ].clrn=!clear; stks[ ].clrn=!clear; cntp[ ].clrn=!clear;
cntd[2..0]=cntd[2..0]+1; cntd3.d=cntd2.q; cntd4.d=cntd3.q;
tmdt=cntd2 and !cntd4; d0.d = (start or clkm or clear); d1.d= d0.q;
dbnc =((d0 AND d1) OR dbnc) AND (d0 OR d1); case ssk[ ] is when
b"00"=> if dbnc==vcc then ssk[ ]=b"01"; else ssk[ ]=b"00"; end
if; when b"01"=> ssk[ ]=b"10"; when b"10"=> if dbnc== gnd
then ssk[ ]=b"00"; else ssk[ ]=b"10"; end if; when b"11"=> ssk[
]=b"00"; end case; case stks[ ] is when b"0000"=> if (ssk0 ==vcc
) then stks[ ]=b"0001"; else stks[ ]=b"0000"; end if; when
b"0001"=> stks[ ]=b"0010"; when b"0010"=> stks[ ]=b"0100";
when b"0100"=> stks[ ]=b"1000"; when b"1000"=> if (cntp[ ]
==0 or cntp[ ]==1 or cntp[ ]==2 or cntp[ ]==3 ) then stks[
]=b"0001"; elsif (cntp[ ]==5 ) thenstks[ ]=b"0000"; else stks[
]=b"1000"; end if; end case;
if (stks3 ==vcc) and (cntp[ ] !=5) then cntp[ ]=cntp[ ]+1; else
cntp[ ]=cntp[ ]; end if; r/w = !(stks0 or stks1 or stks2) ; en =
stks1 ; if(cntp[ ] ==5) and ((mode==vcc and datai7==gnd) or
(mode==gnd and
romdatai7==gnd)) then d/i= (stks0 or stks1 or stks2) ; else d/i=
!(stks0 or stks1 or stks2); end if; case cntp[ ] is when
b"000"=> db[ ]=h"38"; when b"001"=> db[ ]=h"0e"; when
b"010"=> db[ ]=h"06"; when b"011"=> db[ ]=h"01"; when
b"100"=> db[ ]=h"80"; when b"101"=> if mode==gnd then if
romdatai[7..6]==3 then db[ ]=(romdatai7,0,romdatai[5..0]); elsif
romdatai[7..6]==2 then db[ ]=(0,romdatai[6..0]); else db[
]=romdatai[ ]; end if; else db[ ]=datai[ ]; end if; end case;
end;
18
LCD()
19