当前位置: 首页 > news >正文

VHDL语言基础-时序逻辑电路-寄存器

目录

寄存器的设计:

多位寄存器:      

多位寄存器的VHDL描述:

移位寄存器:

串进并出的移位寄存器的VHDL描述:


寄存器的设计:

多位寄存器:      

一个D触发器就是一位寄存器,如果需要多位寄存器,就要用多个D触发器构成。

多位寄存器的VHDL描述:

Entity reg  is

      generic( n: natural :=4 );                            --实体类属中的常数

        port (  D: in std_logic_vector(n-1 downto 0);

                 clock, reset : in std_logic;

                 Q: out std_logic_vector (n-1 downto 0) );

End reg ;

Architecture behav of reg is

Begin

     process(clock, reset)

     begin

         if (reset=‘0’)  then Q<=( others=>‘0’);       --表示Q赋全‘0 

         elsif rising_edge(clock) then

             Q<=D;

         end if;

       end process;

End  behav ;


移位寄存器:

我们这里讨论的是串进并出的移位寄存器,即串行输入,在时钟的边沿移位进寄存器,形成并行输出

串进并出的移位寄存器的VHDL描述:

Entity   sipo is

       generic( n : natural :=8);

       port ( a : in std_logic ;

                 q: out std_logic_vector(n-1 downto 0);

                 clk : in std_logic );

End sipo;

Architecture behav of sipo is

Begin

    process(clk)

        variable reg : std_logic_vector(n-1 downto 0);

     begin

         if  rising_edge(clk)  then

              reg : = reg ( n-2 downto 0) & a ;   --左移移位寄存器;

                                      -- reg : = a & reg (n-1 downto 1); 右移移位寄存器

          end if ;

          q<= reg ;

    end  process;

End  behav;

 输入8位数据11100100,从仿真波形可以看出,8位数据是从低位左移存储到寄存器中的。

 

http://www.lryc.cn/news/1249.html

相关文章:

  • 高通开发系列 - linux kernel更新msm-3.18升至msm-4.9
  • 【Tensorflow2.0】tensorflow中的Dense函数解析
  • PyTorch学习笔记:data.RandomSampler——数据随机采样
  • 设计模式(七)----创建型模式之建造者模式
  • DCGAN
  • 【速通版】吴恩达机器学习笔记Part3
  • 【leetcode】跳跃游戏
  • 论文投稿指南——中文核心期刊推荐(冶金工业 2)
  • 【GPLT 二阶题目集】L2-044 大众情人
  • SpringBoot整合(二)MyBatisPlus技术详解
  • 导入importk8s集群,添加node节点,rancher agent,Rancher Agent设置选项
  • C++11--右值引用与移动语义
  • Python SQLAlchemy入门教程
  • 你是真的“C”——操作符详解【下篇】+整形提升+算术转换
  • 文本匹配SimCSE模型代码详解以及训练自己的中文数据集
  • Biotin-PEG-FITC 生物素聚乙二醇荧光素;FITC-PEG-Biotin 科研用生物试剂
  • FISCO BCOS 搭建区块链,在SpringBoot中调用合约
  • 面试官:int和Integer有什么区别?
  • MFC常用技巧
  • C++ —— 多态
  • java agent设计开发概要
  • node.js笔记-模块化(commonJS规范),包与npm(Node Package Manager)
  • Linux 磁盘坏块修复处理(错误:read error: Input/output error)
  • API 面试四连杀:接口如何设计?安全如何保证?签名如何实现?防重如何实现?
  • 操作系统题目收录(六)
  • 2023年十款开源测试开发工具推荐!
  • MySQL慢查询分析和性能优化
  • C++学习笔记(四)
  • 【4】深度学习之Pytorch——如何使用张量处理时间序列数据集(共享自行车数据集)
  • mulesoft MCIA 破釜沉舟备考 2023.02.10.01