2019-03-25 09:13发布
简单设计一下这个程序如下:
process(clk,rst)
begin
if (rst='0') then
state<=(others=>'0');
sl<='1';
sclk<='1';
sdi<='0';
elsif clk'event and clk='1' then
if (state=x"0") then
data<=tx_data( 需要发送的数据)
state<=x"1";
elsif (state=x"1") then
sl<='0';
sclk<='0';
state<=x"2";
elsif (state=x"2") then
if(cnt=39) then ( 数据位数)
cnt<=0;
state<=x"3";
else
cnt<=cnt+1;
end if
sdi<=data(39);
data<=data(38 downto ) & '0';
elsif (state=x"3") then
state<=x"0";
end if;
end process;
最多设置5个标签!
简单设计一下这个程序如下:
process(clk,rst)
begin
if (rst='0') then
state<=(others=>'0');
sl<='1';
sclk<='1';
sdi<='0';
elsif clk'event and clk='1' then
if (state=x"0") then
data<=tx_data( 需要发送的数据)
state<=x"1";
sl<='1';
elsif (state=x"1") then
sl<='0';
sclk<='0';
state<=x"2";
elsif (state=x"2") then
if(cnt=39) then ( 数据位数)
cnt<=0;
state<=x"3";
else
cnt<=cnt+1;
state<=x"2";
end if
sdi<=data(39);
data<=data(38 downto ) & '0';
sclk<='1';
elsif (state=x"3") then
sl<='1';
state<=x"0";
else
state<=(others=>'0');
sl<='1';
sclk<='1';
sdi<='0';
end if;
end if;
end process;
一周热门 更多>