📄 tiaojia.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity tiaojia is
--实现调价功能
port
( flag1 : in std_logic; --调价状态标志
sure : in std_logic;
up : in std_logic;
price1 : out std_logic_vector (3 downto 0); --调价输出
price2 : out std_logic_vector (3 downto 0);
price3 : out std_logic_vector (3 downto 0)
);
end entity;
architecture arc of tiaojia is
signal count : std_logic_vector (1 downto 0);
begin
process(up,count)
variable data1 : std_logic_vector (3 downto 0);
begin
if(count /= "00" or flag1='0') then null; --00时调 price1
elsif(up'event and up='1')then
if(data1="1001")then data1:="0000";
else
data1:=data1+1;
end if;
end if;
price1<=data1;
end process;
process(up,count)
variable data2 : std_logic_vector (3 downto 0);
begin
if(count /= "01"or flag1='0') then null; --01时调 price2
elsif(up'event and up='1')then
if(data2="1001")then data2:="0000";
else
data2:=data2+1;
end if;
end if;
price2<=data2;
end process;
process(up,count)
variable data3 : std_logic_vector (3 downto 0);
begin
if(count /= "10"or flag1='0') then null; --10时调 price3
elsif(up'event and up='1')then
if(data3="1001")then data3:="0000";
else
data3:=data3+1;
end if;
end if;
price3<=data3;
end process;
--各位循环调价
process(sure) is
variable count1 : std_logic_vector (1 downto 0):="00";
begin
if( flag1='0') then null;
elsif(sure'event and sure='1')then
if(count1="10")then count1:="00";
else
count1:=count1+1;
end if;
end if;
count<=count1;
end process;
end arc;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -