打印

麻烦大家解释下这段VHDL代码,谢谢

[复制链接]
1637|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
sdnd2000|  楼主 | 2007-5-18 20:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我是初学者,这是书上的一段VHDL的移位寄存器程序,有些地方不是很明白,麻烦大家解释下。

library ieee;
use ieee.std_logic_1164.all;
entity 74_sl_165 is 
port ( clk,c0: in std_logic;
           md: in std_logic_vector(2 downto 0);
           d : in std_logic_vector(7 downto 0);
           qb: out std_logic_vector(7 downto 0);
           cn: out std_logic);
end entity;
architecture behav of 74_sl_165 is
signal reg: std_logic_vector(7 downto 0);
signal cy : std_logic;
begin
process( clk,md,c0)
begin
if clk'event and clk='1' then
case md is
when "001"=> reg(0)<=c0;
   reg(7 downto 1) <=reg (6 downto 0); cy<=reg(7);
when "010"=>reg(0)<=reg(7);
reg(7 downto 1)<=reg (6 downto 0);
when "011"=>reg(7)<=reg(0);
reg(6 downto 0)<= reg(7 downto 1);
when "100"=>reg(7)<=c0;
reg(6 downto 0)<=reg(7 downto 1);cy<=reg(0);
when "101"=>reg(7 downto 0)<= d(7 downto 0);
when others=> reg<=reg; cy<=cy;
end case;
end if;
end process;
qb(7 downto 0)<=reg(7 downto 0); cn<=cy;
end behav;
几点不明白的地方:

1.MD, D,CN这三个端口作用,如果MD是移位控制字那怎么是3位的,不都是2位吗。

2.cy<=reg(7)和cy<=reg(0)这两句的作用是什么呀?

3.这是个什么样寄存器,感觉和4个D触发器组成的寄存器不太一样。

呵呵,我是新手,大家别见笑,谢谢。

相关帖子

沙发
wuw| | 2007-5-18 23:45 | 只看该作者

个人意见

循环寄存器,可以左右移位的。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

13

主题

17

帖子

0

粉丝