关于通过状态机实现并转串的数据传输的问题

By: yunfeiyang1997

library ieee;
&t zl/bb b$z-ouse ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
v7y5y:dh\buse ieee.std_logic_arith.all;



--  entity declaration

entity piso is
        -- {{altera_io_begin}} do not remove this line!
        port
        (
                cs         : in std_logic;
1da$[a v+o+zmwn                latchclock : in std_logic;
                shiftclock : in std_logic;
j8c#c'v(]vxv                din        : in std_logic_vector(7 downto 0);
bhju bn                dout       : out std_logic
j4k0z-a.tp#w.f        );
        -- {{altera_io_end}} do not remove this line!
        
znt6tg tend piso;

en!fu3s
--  architecture body
|,w:lk|ews.p
architecture piso_architecture of piso is
*e9e ]#fqdy
^p-sn"s?,ul'btype state is (load,p2s);
2di0v |$e#[
signal data_register : std_logic_vector(7 downto 0);
$g\'_6n(w/f#]&r+g*tsignal current_state,next_ss  : state;
o4p6zyf"?nd
begin
o m[s*f
fejl|&htfp0:process(shiftclock,cs)
zlj jydbegin
  if cs='0' then
mn6_o hqs"j     dout<='1';
  elsif rising_edge(shiftclock) then
        current_state<=next_ss;
        --null;
        --null;
        --null;

     if current_state=load then
        data_register<=din;
     elsif current_state=p2s then
           data_register<=data_register(6 downto 0)&'1';
*u"tt5]b?4}.f m           dout<=data_register(7);
k%grb a3~  --else null;
     end if;
%t(jyb?xe)`end if;
l)|%{3ih0w8]tzhd
end process ;

p1:process(latchclock,current_state,next_ss)
begin
  if latchclock='1' then
     next_ss<=load;
  else next_ss<=p2s;
  --case current_state is
      -- when load =>
               --if latchclock='1' then
                  --next_s<= load;
              -- else
                  --next_s<=p2s;
               --end if;
       --when p2s=>
!m9ly4^-n+qh+bxb               --if latchclock='1' then
                  --next_s<= load;
               --else
                  --next_s<=p2s;
               --end if;
  --end case;
$fb@m*?end if;
c]"a\h h%dend process p1;
([4c[2d-w1~#q
--p2:process(shiftclock,cs)
'rx4xb&n `&gss5o(k--begin
  --if cs ='0' then
1|w%x/p(fin3o6u     --dout<='1';
  --elsif rising_edge(shiftclock) then
jm d[c0f4\     --if current_state=load then
        --data_register<=din;
b?(m \&a5@8n6t%`     --elsif current_state=p2s then
           --data_register<=data_register(6 downto 0)&'1';
           --dout<=data_register(7);
|2vwgd-edhd      --end if;
o_b0ofg   --end if;
v0sh7n+csi7z_0z g--end process;

\hm[ waw$}end piso_architecture;
jx7xrdi;j
?[ d8h/taqtf大家好,小弟这里有个问题。

上面的程序仿真运行之后,实现了并转串的功能
但是存在三个shiftclock周期的时延,不知道是否是状态机本身的时延?
f5r/ctv还是其它的原因?
代码如上所示,以下为仿真波形:

该文来自:设计互动 (www.ccflash.org),更多请参考以上网站.

Username