VHDL 编译器是否会对此进行优化?
Will a VHDL compiler optimise this away or not?
如果我有一个依赖常量参数的像下面这样的操作,编译器会看到这个 if 语句总是第一个 case 并因此优化它吗?
entity Thing is
generic(
constant N : integer := 32;
constant M : integer := 24
);
...
architecture behaviour of Thing is
...
process(clk)
begin
if(rising_edge(clk)) then
...
if N > M then
-- do a thing
else
-- do a different thing
end if;
...
end if;
end process;
end behaviour;
在我使用过的任何综合工具中,任何常量(包括 generics
)都会通过设计传播,以产生尽可能简单的输出。这对整体性能有好处。
如果我有一个依赖常量参数的像下面这样的操作,编译器会看到这个 if 语句总是第一个 case 并因此优化它吗?
entity Thing is
generic(
constant N : integer := 32;
constant M : integer := 24
);
...
architecture behaviour of Thing is
...
process(clk)
begin
if(rising_edge(clk)) then
...
if N > M then
-- do a thing
else
-- do a different thing
end if;
...
end if;
end process;
end behaviour;
在我使用过的任何综合工具中,任何常量(包括 generics
)都会通过设计传播,以产生尽可能简单的输出。这对整体性能有好处。