VHDL:将数值放入 STD_LOGIC_VECTOR 变量的代码
我想在 STD_LOGIC_VECTOR 类型的变量中输入一个数字,但编译器有问题。
signal cl_output_ChA : STD_LOGIC_VECTOR (16-1 downto 0);
cl_ouput_ChA <= 111111111111111;
编译器给我以下两条消息:
- 111111111111111 的整数值大于整数'high。
- cl_output_ChA 的类型与 111111111111111 的类型不兼容。
任何人都可以给我一个正确的代码行来在此变量中放入特定的数值吗? 太感谢了。
I would like to enter a number in a a variable of type STD_LOGIC_VECTOR but I have problems with the compiler.
signal cl_output_ChA : STD_LOGIC_VECTOR (16-1 downto 0);
cl_ouput_ChA <= 111111111111111;
The compiler give me these two messages:
- The integer value of 111111111111111 is greater than integer'high.
- Type of cl_output_ChA is incompatible with type of 111111111111111.
could anyone give me a proper code line to put in this variable a particular numeric value?
Thank you so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,错误是因为您编写的数字被视为整数。
我认为你的意思是数字是二进制的?在这种情况下使用“”。
您也可以选择十六进制,x""。
如果你想将一个整数分配给一个std_logic_vector,那么你可以这样做。
其中 12345 是整数(或自然数),16 是宽度。
First of all, the error is because the number as you have written it is treated as an integer.
I take that you mean for the number to be binary? In that case use "".
You can also go for hex, x"".
If you want to assign an integer to an std_logic_vector, then you can do it like this.
Where 12345 is the integer (or natural) and 16 is the width.
您还可以执行以下操作,在每位中添加 1。
You could also do the following, which puts a 1 in each bit.