左移寄存器vhdl_vhdl怎么表示8位左右移位寄存器?

博客内容涉及VHDL编程,具体是关于如何表示8位左移和右移位寄存器的问题。在给出的代码中,存在编译错误,特别是在使用shared variable i 的初始化语句上。错误提示指向了语法错误,可能是预期的语法与实际使用的不匹配。作者寻求帮助以解决这个特定的语法错误。
摘要由CSDN通过智能技术生成

这样有错吗?libraryieee;useieee.std_logic_1164.all;entityshift8isport(d,clk:instd_logic;b0,b1,b2,b3,b4,b5,b6,b7:outstd_logic);endentityshift8;architecturertlofshift8issha...

这样有错吗?

library ieee;

use ieee.std_logic_1164.all;

entity shift8 is

port(d,clk:in std_logic;

b0,b1,b2,b3,b4,b5,b6,b7:out std_logic);

end entity shift8;

architecture rtl of shift8 is

shared variable i: integer [:=0];

signal q:std_logic_vector(7 downto 0);

begin

process(clk)is

begin

if(clk'event and clk='1')then

if(d='1')then

if(i=7)then q(i)<='0';

else(q(i+1)<=q(i),

i:=i+1);

end if;

else

if(i=0)then q(i)<='0';

else(q(i-1)<=q(i),

i:=i-1);

end if;

end if;

end if;

b0<=q(0);

b1<=q(1);

b2<=q(2);

b3<=q(3);

b4<=q(4);

b5<=q(5);

b6<=q(6);

b7<=q(7);

end process;

end architecture rtl;

编译时出现了错误

ERROR:HDLParsers:164 - "D:/xilinx/shift/shift.vhd" Line 9. parse error, unexpected AFFECT, expecting RETURN or IDENTIFIER or RSQBRACK

想问一下哪里出错了

错误的位置显示在shared variable i: integer [:=0];这句

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值