集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 2389|回复: 3

这是一个4位的移位寄存器DIR是不是控制左移或者右移的

[复制链接]
UFO 发表于 2010-6-26 02:10:05 | 显示全部楼层 |阅读模式
本帖最后由 fpgaw 于 2010-7-16 13:30 编辑

library IEEE;
use IEEE.std_logic_1164.all;

entity shft_reg is
  port (
      DIR : in std_logic;
      CLK : in std_logic;
      CLR : in std_logic;
      SET : in std_logic;
      CE : in std_logic;
      LOAD : in std_logic;
      SI : in std_logic;
      DATA : in std_logic_vector(3 downto 0);
      data_out : out std_logic_vector(3 downto 0)
  );
end entity;



architecture shft_reg_arch of shft_reg is
signal TEMP_data_out : std_logic_vector(3 downto 0);
begin

  process(CLK)
  begin
      if rising_edge(CLK) then
        if CE = '1' then
          if CLR = '1' then
              TEMP_data_out <= "0000";
          elsif SET = '1' then
              TEMP_data_out <= "1111";
          elsif LOAD = '1' then
              TEMP_data_out <= DATA;
          else
              if DIR = '1' then
                TEMP_data_out <= SI & DATA(3 downto 1);
              else
                TEMP_data_out <= DATA(2 downto 0) & SI;
              end if;
          end if;
        end if;
      end if;
  end process;

  data_out <= TEMP_data_out;

end architecture;
注:这是一个4位的移位寄存器DIR是不是控制左移或者右移的
inter 发表于 2010-6-26 02:27:19 | 显示全部楼层
of course
tim 发表于 2010-6-26 02:51:46 | 显示全部楼层
就问个这么简单的问题?
interig 发表于 2010-6-26 03:36:53 | 显示全部楼层
应该是dirction的意思了,呵呵,习惯性的缩写
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-5-15 12:03 , Processed in 0.070849 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表