当前位置:   article > 正文

VHDL除法移位处理_fpga vhdl 移位除以1000

fpga vhdl 移位除以1000

VHDL除法的过程中可以使用二进制的移位处理。

通过SLL实现五比特数的移动,另外常见的还有
SRL 逻辑右移 ---- 实现数据右移,左端补0;
SLA 算术左移 ---- 实现数据左移,同时复制最右端的位,填充在右端空出的位置;
SRA 算术右移 ---- 实现数据右移,同时复制最左端的位,填充在左端空出的位置;
ROL 循环逻辑左移 ---- 实现数据左移,从左端移出的位填充到右端空出的位置上;
ROR 循环逻辑右移 ----实现 数据右移,从右端移出的位填充到左端空出的位置上。

移位的类型必须为std_logic_vector j<= std_logic_vector(i sll 1);
或者如果为std_logic_vector类型,就在一个语句里面进行两次类型装换。P<=to_std_logic_vector( to_bit_vector(i) SLL 2 )

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity test is
        port (
                i: in std_logic_vector (15 downto 0);
                j: out std_logic_vector (15 downto 0)
                signal p :std_logic_vector (15 downto 0) :
        );
end entity test;
architecture a of test is begin
        **j<= std_logic_vector(unsigned(i) sll 1);**
        P<=to_std_logic_vector( to_bit_vector(i) SLL 2 )
end architecture a;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

https://www.amobbs.com/thread-3732803-1-1.html
http://bbs.elecfans.com/jishu_927654_1_1.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/432421
推荐阅读
相关标签
  

闽ICP备14008679号