【发布时间】:2018-01-13 19:04:03
【问题描述】:
在 VHDL '93 中,编译器告诉我它为运算符“=”找到了 0 个可能的定义。 它会导致错误并显示以下错误消息:
Error (10327): VHDL error at mst_fifo_fsm.vhd(171): can't determine definition of operator ""="" -- found 0 possible definitions
第 171 行是 ifsm_cond(0) 的第一个赋值:
process(clk, rst_n)
begin
if (rst_n = '0') then
ifsm_cond <= "0000";
elsif (rising_edge(clk)) then
if (mltcn = '0') then
ifsm_cond(0) <= (cur_stap1 = IDLE) AND (not imst_rd_n(0)) AND (not rxf_n) AND (not ibuf_ful(0));
ifsm_cond(1) <= (cur_state = MTRD) AND ( imst_rd_n(0) OR (rxf_n AND (not rxf_n_p1)) OR ibuf_ful(0)) ;
ifsm_cond(2) <= (cur_state = MDLE) AND (not imst_wr_n(0)) AND (not txe_n)& (ibuf_nep(0) OR stren OR w_1byte) AND (not w_1flag);
ifsm_cond(3) <= (cur_stap3 = MTWR) AND ( imst_wr_n(0) OR (txe_n AND (not txe_n_p1)) OR r_oobe OR ((not ififonempt(0)) AND (not stren) AND (not prefnempt(0))));
else
ifsm_cond(0) <= (not imst_rd_n(conv_integer(ichannel))) AND (not irxf_n(conv_integer(ichannel))) AND (not ibuf_ful(conv_integer(ichannel))) AND (cur_stap3 = IDLE);
ifsm_cond(1) <= ( imst_rd_n(conv_integer(ichannel)) OR (rxf_n & (not rxf_n_p1)) OR ibuf_ful(conv_integer(ichannel))) AND (cur_state = MTRD);
ifsm_cond(2) <= (not imst_wr_n(conv_integer(ichannel))) AND (not itxe_n(conv_integer(ichannel))) AND (ibuf_nep(conv_integer(ichannel)) OR stren) AND (cur_stap3 = MDLE);
ifsm_cond(2) <= (not imst_wr_n(conv_integer(ichannel))) AND (not itxe_n(conv_integer(ichannel))) AND (ibuf_nep(conv_integer(ichannel)) OR stren) AND (cur_stap3 = MDLE);
ifsm_cond(3) <= ( imst_wr_n(conv_integer(ichannel)) OR (rxf_n AND
(not rxf_n_p1)) OR ((not ififonempt(conv_integer(ichannel)) AND (not stren)
AND (not prefnempt(conv_integer(ichannel)))))) AND (cur_stap3 = MTWR);
end if;
end if;
end process;
我猜它在语句中 (cur_stap1 = IDLE)。
cur_stap1 是一个用户定义的信号,声明如下:
type states is (IDLE, MTRD, MDLE, MTWR);
signal cur_state, next_statem, cur_stap1, cur_stap2, cur_stap3, cur_stap4 :
states;
如果 cur_stap1 为 IDLE,我想一种可能的解决方案首先在条件并发信号分配中澄清,并将其分配给替换 (cur_stap1 = IDLE) 的信号。但我还有一些其他类似这样的陈述。
有没有更好的解决方案来解决这个问题?这种并发信号分配是在一个进程中完成的。我是否应该为整行尝试使用 IF ELSIF END IF 语句?
提前谢谢你。
【问题讨论】:
-
提供一个Minimal, Complete and Verifiable example,包括上下文子句/项目和声明。完整的错误消息也很有帮助。否则,在不知道更好的情况下 cur_stap = IDLE 似乎会返回一个布尔值。
not rxf_n之类的,类型为 rxf_n 的值被声明为。没有预定义的逻辑运算符混合布尔值和不同类型作为操作数。考虑学习运算符优先级,不需要任何表达式括号。 -
是的,您可以在那里使用该运算符。但是你必须确保一个匹配的
=函数声明是可见的。将其设为minimal reproducible example,我们将能够看到错误。但是要么 NO=是可见的(你正在比较不同的类型或返回错误的类型......布尔值你需要 std_logic 的地方)或者两个或更多是可见的(也许你写了你自己的=并且也有一个内在的) . -
@BrianDrummond 我在上面的帖子中进行了编辑。我想我需要 std_logic 但 (cur_stap1 = IDLE) 会给我一个布尔返回类型。匹配 = 函数声明是什么意思?
-
@JHBonarius 我把它改成了想要的信息。
-
现在我们有了声明,我们可以看到没有与参数和返回类型匹配的
=函数,具体来说,没有function "=" (L,R : states) return std_logic;,而这段代码需要一个。不一定推荐这种方法(除了作为理解 VHDL 的练习),但是:没有什么可以阻止你写一个。
标签: vhdl