📄 top.vhd
字号:
else if (DB = 2) then
NextState <= char_2M;
else NextState <= stop;
end if;
end if;
when char_1S =>
if((lcd_ready = '1')) then
NextState <= char_1I;
else NextState <= char_1S;
end if;
when char_1I =>
if((lcd_ready = '1')) then
NextState <= char_1N;
else NextState <= char_1I;
end if;
when char_1N =>
if((lcd_ready = '1')) then
NextState <= char_1G;
else NextState <= char_1N;
end if;
when char_1G =>
if((lcd_ready = '1')) then
NextState <= char_1L;
else NextState <= char_1G;
end if;
when char_1L =>
if((lcd_ready = '1')) then
NextState <= char_1E;
else NextState <= char_1L;
end if;
when char_1E =>
if((lcd_ready = '1')) then
NextState <= gotonextline1;
else NextState <= char_1E;
end if;
when char_2M =>
if((lcd_ready = '1')) then
NextState <= char_2A;
else NextState <= char_2M;
end if;
when char_2A =>
if((lcd_ready = '1')) then
NextState <= char_2R;
else NextState <= char_2A;
end if;
when char_2R =>
if((lcd_ready = '1')) then
NextState <= char_3R;
else NextState <= char_2R;
end if;
when char_3R =>
if((lcd_ready = '1')) then
NextState <= char_2I;
else NextState <= char_3R;
end if;
when char_2I =>
if((lcd_ready = '1')) then
NextState <= char_2E;
else NextState <= char_2I;
end if;
when char_2E =>
if((lcd_ready = '1')) then
NextState <= char_2D;
else NextState <= char_2E;
end if;
when char_2D =>
if((lcd_ready = '1')) then
NextState <= gotonextline1;
else NextState <= char_2D;
end if;
when gotonextline1 =>
if((lcd_ready = '1')) then
NextState <= char_3A;
else NextState <= gotonextline1;
end if;
when char_3A =>
if((lcd_ready = '1')) then
NextState <= char_3G;
else NextState <= char_3A;
end if;
when char_3G =>
if((lcd_ready = '1')) then
NextState <= char_3E;
else NextState <= char_3G;
end if;
when char_3E =>
if((lcd_ready = '1')) then
NextState <= char_space;
else NextState <= char_3E;
end if;
when char_space =>
if((lcd_ready = '1')) then
NextState <= getage;
else NextState <= char_space;
end if;
when getage =>
NextState <= get_char_10s;
when get_char_10s =>
if((ascii_done = '1')) then
NextState <= char_10s;
else NextState <= get_char_10s;
end if;
when char_10s =>
if((lcd_ready = '1')) then
NextState <= char_10s_done;
else NextState <= char_10s;
end if;
when char_10s_done =>
NextState <= get_char_ones;
when get_char_ones =>
if((ascii_done = '1')) then
NextState <= char_ones;
else NextState <= get_char_ones;
end if;
when char_ones =>
if((lcd_ready = '1')) then
NextState <= stop;
else NextState <= char_ones;
end if;
when stop =>
NextState <= stop;
end case;
end process COMB;
SEQ: process(ireset, clk)
begin
if(ireset = '1') then
CurrentState <= Idle;
elsif (clk'event and clk = '1') then
CurrentState <= NextState;
end if;
end process SEQ;
with CurrentState select
lcd_w <= --'1' when WriteCommand,
'1' when WriteData,
'1' when Char_F,
'1' when Char_E,
'1' when Char_M,
'1' when Char_A,
'1' when Char_L,
'1' when Char_E2,
'1' when clearscreen,
'1' when Char_1S,
'1' when Char_1I,
'1' when Char_1N,
'1' when Char_1G,
'1' when Char_1L,
'1' when Char_1E,
'1' when Char_2M,
'1' when Char_2A,
'1' when Char_2R,
'1' when Char_3R,
'1' when Char_2I,
'1' when Char_2E,
'1' when Char_2D,
'1' when Char_3A,
'1' when Char_3G,
'1' when Char_3E,
'1' when Char_space,
'1' when Char_10s,
'1' when Char_ones,
'0' when Others;
with CurrentState select
CharBus <=
x"46" when Char_F,
x"45" when Char_E,
x"4D" when Char_M,
x"41" when Char_A,
x"4C" when Char_L,
x"45" when Char_E2,
x"01" when clearscreen,
x"53" when Char_1S,
x"49" when Char_1I,
x"4E" when Char_1N,
x"47" when Char_1G,
x"4C" when Char_1L,
x"45" when Char_1E,
x"4D" when Char_2M,
x"41" when Char_2A,
x"52" when Char_2R,
x"52" when Char_3R,
x"49" when Char_2I,
x"45" when Char_2E,
x"44" when Char_2D,
x"41" when Char_3A,
x"47" when Char_3G,
x"45" when Char_3E,
x"20" when Char_space,
ascii_db when Get_Char_10s,
ascii_db when Char_10s,
ascii_db when Char_10s_done,
--x"31" when Char_10s,
ascii_db when Get_Char_ones,
ascii_db when Char_ones,
--x"31" when Char_ones,
DB when Others;
with CurrentState select
AddrBus <=
"1000000001111" when getsex,
"1000000001111" when checksex,
"1000000010000" when getstatus,
"1000000010000" when checkStatus,
"1000000010001" when getage,
"1000000010001" when get_char_10s,
"1000000010001" when char_10s,
"1000000010001" when get_char_ones,
"1000000010001" when char_ones,
"10000000" & addr when others;
with CurrentState select
lcd_nextc <= '1' when Nextc,
'0' when Others;
with CurrentState select
sram_reset <= '1' when Standby,
'0' when Others;
with CurrentState select
counter_enable <= '1' when delay_loop,
'0' when Others;
with CurrentState select
lcd_line2 <= '1' when gotonextline,
'1' when gotonextline1,
'0' when Others;
with CurrentState select
nextscreen <= '1' when clearscreen,
'0' when Others;
with CurrentState select
ascii_enable <= '1' when get_char_10s,
'1' when char_10s,
'1' when get_char_ones,
'1' when char_ones,
'0' when Others;
with CurrentState select
ascii_ref <= '1' when get_char_10s,
'1' when char_10s,
'0' when get_char_ones,
'0' when char_ones,
'0' when Others;
--**************************************************************************
-- 5-bit sram address counter
--**************************************************************************
addr_clk <= (sc_data_ready) or (lcd_nextc);
process(ireset, addr_clk, sram_reset)
begin
if((ireset = '1') or (sram_reset = '1')) then
addr <= (others=>'0');
elsif (addr_clk'event and addr_clk = '1') then
addr <= addr + 1;
end if;
end process;
--**************************************************************************
-- 24-bit counter
--**************************************************************************
process(ireset, counter_enable)
begin
if(ireset = '1') then
counter <= (others=>'0');
elsif (clk'event and clk = '1') then
if(counter_enable = '1') then
counter <= counter + 1;
end if;
end if;
end process;
--debug only
--add_8 <= '1' when (addr = 8) else '0';
--ledclk <= '1' when ((add_8 = '1') and (sc_done = '0')) else '0';
--process(ledclk)
--begin
-- if(ledclk'event and ledclk = '1') then
-- led <= not sram_db;
-- end if;
--end process;
--end debug
sc_done_bar <= ireset;-- or nextscreen; --reset LCD
ireset <= (not reset) or (not enable); -- reset button or card not present
char <= '1' when (((DB > 64) and (DB < 91)) or ((DB > 96) and (DB < 123))) else '0';
--num <= '1' when ((DB > 47) and (DB < 58)) else '0';
dce <= '1'; -- always write to LCD
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -