Reverse bit order on VHDL

后端 未结 6 1008
闹比i
闹比i 2021-01-31 19:48

I\'m having trouble doing something like

b(0 to 7) <= a(7 downto 0)

when I compile it with ghdl, I have an order error. The only way I have

6条回答
  •  鱼传尺愫
    2021-01-31 20:14

    Suggestions?

    Because your example specifies fixed length:

    architecture rtl of reverser is 
        -- signal b: std_logic_vector (7 downto 0);
    
    begin
    
        -- b(7) <= a(0);
        -- b(6) <= a(1);
        -- b(5) <= a(2);
        -- b(4) <= a(3);
        -- b(3) <= a(4);
        -- b(2) <= a(5);
        -- b(1) <= a(6);
        -- b(0) <= a(7);
    
        -- y <= b when rev = '1' else a;
    
        y <= a(0)&a(1)&a(2)&a(3)&a(4)&a(5)&a(6)&a(7) when rev = '1' else a;
    
    end rtl;
    

    The theory being that this should be less overhead than a function call or loop statement.

提交回复
热议问题