【发布时间】:2014-04-12 16:27:16
【问题描述】:
这是我第一次使用 VHDL,所以它肯定是一些基本的东西,但不知道该怎么做。
我有这个代码:
--this is in the architecture segment
type my_code is array(0 to 15) of integer;
signal code: my_code;
....
--here I use the array
code(count) <=0; --I save a value into the array on position defined by the count variable
if (code(0) = '0') then --fail line (want to do something if the first element is 0)
--do something
end if;
编译器阻止了我,因为“在这种情况下不能有这样的操作数”。问题出在 if 语句上。这有什么问题?
我基本上是在做一个数字锁,就像你写代码一样,如果代码错误,它会打开或保持关闭,所以我只想检查按下的按键数组是否正确。
抱歉打扰了,但我就是不明白。谢谢,祝你有愉快的一天^^
【问题讨论】:
标签: arrays if-statement vhdl operands