gpt4 book ai didi

java - 是否可以在内核端比较两个 DFEVar 值

转载 作者:行者123 更新时间:2023-11-30 08:37:35 25 4
gpt4 key购买 nike

我正在使用 Maxeler、MaxIDE。我想在下一个周期使用我的输入流作为输出流。我希望在 if 条件下做出决定。但是 if 条件不允许我比较两个 DFEVar(s)。我想知道这可能吗?

类型不匹配:无法将 DFEVar 转换为 boolean

最佳答案

您不能使用常规的 if 语句来比较两个 DFE变量
您应该改用三元运算符。有关详细信息,请参阅下面的第 2 点。

您可以在 Maxeler 教程中找到详细说明。

来自:MaxCompiler:数据流编程教程

Conditionals in dataflow computing

There are three main methods of controlling conditionals that affect dataflow computation:

  1. Global conditionals: These are typically large scale modes of operation depending on input pa- rameters with a relatively small number of options. If we need to select different computations based on input parameters, and these conditionals affect the dataflow portion of the design, we simply create multiple .max files for each case. Some applications may require certain transformation to get them into the optimal structure for supporting multiple .max files. if (mode==1) p1(x); else p2(x); where p1 and p2 are programs that use different .max files.
  2. Local Conditionals: Conditionals depending on local state of a computation. if (a > b) x=x+1; else x=x − 1; These can be transformed into dataflow computation as x = (a > b) ? (x+1) : (x − 1);
  3. Conditional Loops: If we do not know how long we need to iterate around a loop, we need to know a bit about the loop’s behavior and typically values for the number of loop iterations. Once we know the distribution of values we can expect, a dataflow implementation pipelines the optimal number of iterations and treats each of the block of iterations as an action for the SLiC interface, controlled by the CPU (or some other kernel).

The ternary-if operator ( ?: ) selects between two input streams. To select between more than W two streams, the control.mux method is easier to use and read than nested ternary-if statements.

关于java - 是否可以在内核端比较两个 DFEVar 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37083665/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com