首页 > 解决方案 > VHDL 中的 Verilog 波浪号运算符“~”等价于什么?

问题描述

在 Verilog 和 c 语言中,我可以通过使用波浪号运算符轻松否定向量。例子:

// Verilog
module try;
wire [7:0] a = 8'b1111_0000;
reg  [7:0] b;

initial begin
    b = ~a;
    // b = 8'b0000_1111;
end

endmodule

我将如何在 VHDL 中做同样的事情?

-- VHDL
library ieee;
use ieee.std_logic_1164.all;

entity design is
end entity;

architecture rtl of design is
    a: std_logic_vector(7 downto 0) := X"0F";
    b: std_logic_vector(7 downto 0);
begin
    b <= ?negate? a;
    -- result: b = X"F0"
end architecture;

标签: vhdl

解决方案


not运营商:

b <= not a;

推荐阅读