加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

VHDL std_logic_vector索引与“downto”

发布时间:2020-12-15 05:00:18 所属栏目:Java 来源:网络整理
导读:我想分别设置std_logic_vector的位,以便轻松地为各个位或位组设置注释.这是我有的: signal DataOut : std_logic_vector(7 downto 0);...DataOut = ( 5='1',-- Instruction defined 4='1',-- Data length control bit,high=8bit bus mode selected 3='1',--
我想分别设置std_logic_vector的位,以便轻松地为各个位或位组设置注释.这是我有的:

signal DataOut : std_logic_vector(7 downto 0);
...
DataOut <= (                        5=>'1',-- Instruction defined
                                    4=>'1',-- Data length control bit,high=8bit bus mode selected
                                    3=>'1',-- Display Line Number ctrl bit,high & N3 option pin to VDD=3 lines display
                                    2=>'0',-- Double height font type control byte,not selected
                                    1 downto 0=>"01",-- Select Instruction table1
                                    others=>'0' -- for bits 6,7
                                    );

但是,我对“downto”语句有疑问,使用Xilinx ISE时出现以下错误:

Type std_ulogic does not match with a string litteral

避免使用等效的任何解决方案

1=>'0',0=>'1',

并允许我逐块设置?

解决方法

赋值X downto Y =>当A是数组的元素时,’A’是正确的.例如,此代码段是正确的:

1 downto 0 => '1',

而这个片段是错误的:

1 downto 0 => "01",

因此,您的任务是非法的.作为您的代码,您可以指定为:

DataOut <= (                        5 downto 3 =>'1',2 downto 1 =>'0',0 => '1',others=>'0' 
                                    );

如果要通过数组访问/分配,可以使用连接:

DataOut <= Something_0 & Something_1 & "01";

虽然Something_ *是std_logic_vector

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读