?? control.vhd
字號:
if commanda(1)='0' then
bcd_a_up<=0;
elsif ior'event and ior='1' then
if aen&sa(16 downto 0)="0000000"&base_address&"00001" then
bcd_a_up<=bcd_a_up+1;
end if;
end if;
end process;
process(ior,commandb)
begin
if commandb(1)='0' then
bcd_b_up<=0;
elsif ior'event and ior='1' then
if aen&sa(16 downto 0)="0000000"&base_address&"00001" then
bcd_b_up<=bcd_b_up+1;
end if;
end if;
end process;
process(ior,aen,sa,base_address,bcd_a_down,bcd_a_up)
begin
if aen&sa(16 downto 0)="0000000"&base_address&"00011" and ior='0' then
sd(3 downto 0)<=conv_std_logic_vector(bcd_a_down,4);
sd(7 downto 4)<=conv_std_logic_vector(bcd_a_up,4); --上行段操作數無法回讀
else
sd<=(others=>'Z');
end if;
end process;
process(ior,aen,sa,base_address,bcd_b_down,bcd_b_up)
begin
if aen&sa(16 downto 0)="0000000"&base_address&"00111" and ior='0' then
sd(3 downto 0)<=conv_std_logic_vector(bcd_b_down,4);
sd(7 downto 4)<=conv_std_logic_vector(bcd_b_up,4); --上行段操作數無法回讀
else
sd<=(others=>'Z');
end if;
end process;
--************************************************************************************************
process(ior,aen,sa,base_address,stata)
begin
if aen&sa(16 downto 0)="0000000"&base_address&"00010" and ior='0' then
sd(4 downto 0)<=stata;
else
sd(4 downto 0)<="ZZZZZ";
end if;
end process;
process(rstdrv,mcu_command_a)
begin
if rstdrv='1' then
wr_a_up<=0;
elsif mcu_command_a(1)'event and mcu_command_a(1)='0' then
if stata(3)='0' then
if wr_a_up=7990 then
wr_a_up<=0;
else
wr_a_up<=wr_a_up+10;
end if;
end if;
end if;
end process;
process(rstdrv,commanda)
begin
if rstdrv='1' then
rd_a_up<=7990;
elsif commanda(1)'event and commanda(1)='1' then
if stata(1)='1' then
if rd_a_up=7990 then
rd_a_up<=0;
else
rd_a_up<=rd_a_up+10;
end if;
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
stata(1)<='0';
elsif sysclk'event and sysclk='1' then
if (rd_a_up=wr_a_up-10 or (rd_a_up=7990 and wr_a_up=0)) and commanda(1)='1' then
stata(1)<='0';
elsif stata(1)='0' and (rd_a_up/=wr_a_up-10 and not(rd_a_up=7990 and wr_a_up=0)) then
stata(1)<='1';
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
stata(3)<='0';
elsif sysclk'event and sysclk='1' then
if wr_a_up=rd_a_up and mcu_command_a(1)='1' then
stata(3)<='1';
elsif stata(3)='1' and commanda(1)='1' then
stata(3)<='0';
end if;
end if;
end process;
ara<=conv_std_logic_vector(wr_a_up,14);
--******************************************************************************************
process(rstdrv,commanda)
begin
if rstdrv='1' then
wr_a_down<=0;
elsif commanda(0)'event and commanda(0)='0' then
if stata(0)='0' then
if wr_a_down=7990 then
wr_a_down<=0;
else
wr_a_down<=wr_a_down+10;
end if;
end if;
end if;
end process;
process(rstdrv,mcu_command_a)
begin
if rstdrv='1' then
rd_a_down<=7990;
elsif mcu_command_a(0)'event and mcu_command_a(0)='1' then
if stata(4)='1' then
if rd_a_down=7990 then
rd_a_down<=0;
else
rd_a_down<=rd_a_down+10;
end if;
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
stata(4)<='0';
elsif sysclk'event and sysclk='1' then
if (rd_a_down=wr_a_down-10 or (rd_a_down=7990 and wr_a_down=0)) and mcu_command_a(0)='1' then
stata(4)<='0';
elsif stata(4)='0' and (rd_a_down/=wr_a_down-10 and not(rd_a_down=7990 and wr_a_down=0)) then
stata(4)<='1';
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
stata(0)<='0';
elsif sysclk'event and sysclk='1' then
if wr_a_down=rd_a_down and commanda(0)='1' then
stata(0)<='1';
elsif stata(0)='1' and mcu_command_a(0)='1' then
stata(0)<='0';
end if;
end if;
end process;
--************************************************************************************************
process(ior,aen,sa,base_address,statb)
begin
if aen&sa(16 downto 0)="0000000"&base_address&"00110" and ior='0' then
sd(4 downto 0)<=statb;
else
sd(4 downto 0)<="ZZZZZ";
end if;
end process;
process(rstdrv,mcu_command_b)
begin
if rstdrv='1' then
wr_b_up<=0;
elsif mcu_command_b(1)'event and mcu_command_b(1)='0' then
if statb(3)='0' then
if wr_b_up=7990 then
wr_b_up<=0;
else
wr_b_up<=wr_b_up+10;
end if;
end if;
end if;
end process;
process(rstdrv,commandb)
begin
if rstdrv='1' then
rd_b_up<=7990;
elsif commandb(1)'event and commandb(1)='1' then
if statb(1)='1' then
if rd_b_up=7990 then
rd_b_up<=0;
else
rd_b_up<=rd_b_up+10;
end if;
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
statb(1)<='0';
elsif sysclk'event and sysclk='1' then
if (rd_b_up=wr_b_up-10 or (rd_b_up=7990 and wr_b_up=0)) and commandb(1)='1' then
statb(1)<='0';
elsif statb(1)='0' and (rd_b_up/=wr_b_up-10 and not(rd_b_up=7990 and wr_b_up=0)) then
statb(1)<='1';
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
statb(3)<='0';
elsif sysclk'event and sysclk='1' then
if wr_b_up=rd_b_up and mcu_command_b(1)='1' then
statb(3)<='1';
elsif statb(3)='1' and commandb(1)='1' then
statb(3)<='0';
end if;
end if;
end process;
--******************************************************************************************
process(rstdrv,commandb)
begin
if rstdrv='1' then
wr_b_down<=0;
elsif commandb(0)'event and commandb(0)='0' then
if statb(0)='0' then
if wr_b_down=7990 then
wr_b_down<=0;
else
wr_b_down<=wr_b_down+10;
end if;
end if;
end if;
end process;
process(rstdrv,mcu_command_b)
begin
if rstdrv='1' then
rd_b_down<=7990;
elsif mcu_command_b(0)'event and mcu_command_b(0)='1' then
if statb(4)='1' then
if rd_b_down=7990 then
rd_b_down<=0;
else
rd_b_down<=rd_b_down+10;
end if;
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
statb(4)<='0';
elsif sysclk'event and sysclk='1' then
if (rd_b_down=wr_b_down-10 or (rd_b_down=7990 and wr_b_down=0)) and mcu_command_b(0)='1' then
statb(4)<='0';
elsif statb(4)='0' and (rd_b_down/=wr_b_down-10 and not(rd_b_down=7990 and wr_b_down=0)) then
statb(4)<='1';
end if;
end if;
end process;
process(rstdrv,sysclk)
begin
if rstdrv='1' then
statb(0)<='0';
elsif sysclk'event and sysclk='1' then
if wr_b_down=rd_b_down and commandb(0)='1' then
statb(0)<='1';
elsif statb(0)='1' and mcu_command_b(0)='1' then
statb(0)<='0';
end if;
end if;
end process;
process(ior,iow,aen,sa,base_address,rd_a_up,bcd_a_up,wr_a_down,bcd_a_down,rd_b_up,bcd_b_up,wr_b_down,bcd_b_down)
begin
if aen&sa(16 downto 0)="0000000"&base_address&"00001" and ior='0' then
al(13)<='0';
al(12 downto 0)<=conv_std_logic_vector(rd_a_up+bcd_a_up,13);
elsif aen&sa(16 downto 0)="0000000"&base_address&"00001" and iow='0' then
al(13)<='1';
al(12 downto 0)<=conv_std_logic_vector(wr_a_down+bcd_a_down,13);
elsif aen&sa(16 downto 0)="0000000"&base_address&"00101" and ior='0' then
al(13)<='0';
al(12 downto 0)<=conv_std_logic_vector(rd_b_up+bcd_b_up,13);
else
al(13)<='1';
al(12 downto 0)<=conv_std_logic_vector(wr_b_down+bcd_b_down,13);
end if;
end process;
end body_control;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -