由于输入输出的位数太多,导致不能用现有的芯片硬件,请教一下高手,我改怎么办啊?
9 个输出是分别连到9个不同的bcd数码管上去的
library ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
ENTITY jzzh IS
PORT (clk12,clk240,clk15,resetj: IN std_logic;
ascore:in std_logic_vector(13 downto 0);
bscore:in std_logic_vector(8 downto 0);
cscore:in std_logic_vector(6 downto 0);
aqian,abai,ashi,age,bbai,bshi,bge,cshi,cge
ut std_logic_vector(3 downto 0));
END jzzh; --ascore 是计费值;
ARCHITECTURE one OF jzzh IS
BEGIN
u1:process(clk240,ascore)--计费按0-9999的规则变化;
variable comba:std_logic_vector(13 downto 0);
variable comba1,comba2,comba3,comba4:std_logic_vector(3 downto 0);
begin
if(clk240'event and clk240='1') then
if(comba<ascore) then
if(comba1<"1001" ) then
comba1:=comba1+1; comba:=comba+1;
elsif(comba2<"1001"
then
comba2:=comba2+1;comba1:="0000";comba:=comba+1;
elsif(comba3<"1001" ) then
comba3:=comba3+1;comba2:="0000";comba1:="0000";comba:=comba+1;
elsif(comba4<"1001" ) then
comba4:=comba4+1;comba3:="0000";comba2:="0000";comba1:="0000";comba:=comba+1;
elsecomba4:="0000";comba3:="0000";comba2:="0000";comba1:="0000";comba:="00000000000000";
end if;
end if;
end if;
aqian<=comba4;abai<=comba3;ashi<=comba2;age<=comba1;
end process u1;
u2:process(clk12,bscore)--路程按0-299的规则变化;
variable combb:std_logic_vector( 8 downto 0);
variable combb1,combb2,combb3:std_logic_vector(3 downto 0);
begin
if(clk12'event and clk12='1') then
if(combb<bscore) then
if(combb1<"1001" ) then
combb1:=combb1+1; combb:=combb+1;
elsif(combb2<"1001" ) then
combb2:=combb2+1;combb1:="0000";combb:=combb+1;
elsif(combb3<"1001"
then
combb3:=combb3+1;combb2:="0000";combb1:="0000";combb:=combb+1;
elsecombb3:="0000";combb2:="0000";combb1:="0000";combb:="000000000";
end if;
end if;
end if;
bbai<=combb3;bshi<=combb2;bge<=combb1;
end process u2;
u3:process(clk15,cscore)--将等待时间按0-299的规则变化;
variable combc:std_logic_vector(6 downto 0);
variable combc1,combc2:std_logic_vector(3 downto 0);
begin
if(clk15'event and clk15='1') then
if(combc<cscore) then
if(combc1<"1001"
then
combc1:=combc1+1; combc:=combc+1;
elsif(combc2<"1001" ) then
combc2:=combc2+1;combc1:="0000";combc:=combc+1;
elsecombc2:="0000";combc1:="0000";combc:="0000000";
end if;
end if;
end if;
cshi<=combc2;cge<=combc1;
end process u3;
end one; |