Process VHDL移位运算符?

Process VHDL移位运算符?,process,while-loop,vhdl,shift,synthesis,Process,While Loop,Vhdl,Shift,Synthesis,我仍在努力适应VHDL的一些怪癖,我有点问题。首先,我知道诸如rol、ror、ssl、srl等移位运算符是不可合成的。本实验室的目的是使用黄金模型在测试台上对照同一事物的可合成版本进行检查 现在,这个程序的目的是将温度计代码转换成3位二进制数。换句话说,温度计代码“00000001”=“001”,“00000011”=“010”,“00000111”=“011”,等等。我基本上是从右到左计算字符串中1的数量。不存在将“0”放在字符串1之间的情况,因此向量“00011101”无效,永远不会出现 我

我仍在努力适应VHDL的一些怪癖,我有点问题。首先,我知道诸如rol、ror、ssl、srl等移位运算符是不可合成的。本实验室的目的是使用黄金模型在测试台上对照同一事物的可合成版本进行检查

现在,这个程序的目的是将温度计代码转换成3位二进制数。换句话说,温度计代码“00000001”=“001”,“00000011”=“010”,“00000111”=“011”,等等。我基本上是从右到左计算字符串中1的数量。不存在将“0”放在字符串1之间的情况,因此向量“00011101”无效,永远不会出现

我已经设计了一个不可合成(到目前为止,不可编译)的算法,我不知道如何工作。基本上,其思想是读取温度计代码,向右移位并递增计数器,直到温度计代码等于零,然后将计数器值分配给3位std_逻辑_向量。下面是我到目前为止所做的代码

library ieee;
use ieee.std_logic_1164.all; 
use ieee.numeric_std.all;

entity therm2bin_g is
    port(therm : inout std_logic_vector(6 downto 0); -- thermometer code
         bin : out std_logic_vector(2 downto 0); -- binary code 
         i : integer range 0 to 7);
end therm2bin_g;    

architecture behavioral_g of therm2bin_g is
begin

golden : process(therm)
begin

    while(therm /= "00000000") loop
        therm <= therm srl 1;
        i = i + 1;      
    end loop;

    bin <= std_logic'(to_unsigned(i,3));

end process golden;
behavioral_g;
ieee库;
使用ieee.std_logic_1164.all;
使用ieee.numeric_std.all;
实体therm2bin_g为
端口(therm:inout标准逻辑向量(6到0);--温度计代码
bin:out std_logic_vector(2到0);--二进制代码
i:整数范围0到7);
末端温度2英寸;
therm2bin的架构行为是
开始
黄金:过程(therm)
开始
while(therm/=“00000000”)循环

therm这是一个可合成的版本。while循环替换为for循环。srl是显式实现的:

entity therm2bin_g is
port(therm : inout std_logic_vector(6 downto 0); -- thermometer code
     bin : out std_logic_vector(2 downto 0); -- binary code 
     i : out integer range 0 to 7);
end therm2bin_g;    

architecture behavioral_g of therm2bin_g is
begin

golden : process(therm)
    variable i_internal: integer range 0 to 7;
begin
    i_internal:=0;
    for idx in 0 to therm'length loop
        if therm/="0000000" then
            therm<='0' & therm(therm'left downto 1);
            i_internal := i_internal + 1;     
        end if;
    end loop;

    bin<=std_logic_vector(to_unsigned(i_internal,bin'length));
    i<=i_internal;

end process golden;
end behavioral_g;
实体therm2bin\g是
端口(therm:inout标准逻辑向量(6到0);--温度计代码
bin:out std_logic_vector(2到0);--二进制代码
i:输出整数范围0到7);
末端温度2英寸;
therm2bin的架构行为是
开始
黄金:过程(therm)
变量i_internal:整数范围0到7;
开始
i_内部:=0;
对于0到therm'长度循环中的idx
如果therm/=“0000000”,则
therm“…诸如rol、ror、ssl、srl等运算符不可合成…”
谁凭谁的权威这么说?你查过了吗?在哪个合成工具上?这是最近的版本,还是20世纪90年代初的版本

请注意,一些工具可能不支持它的观点是愚蠢的。事实上,有些厨房可能没有烤箱,但这并不能阻止人们编写蛋糕食谱。