KonkurStudy

سوال ۸۲ کنکور ارشد مهندسی کامپیوتر ۱۴۰۲

اهمیت
۰/۵

کد Verilog/VHDL زیر را در نظر بگیرید. با توجه به مقادیر ورودی‌ها که به صورت شکل موج داده شده‌اند، خروجی Z کدام است؟

Verilog

module ParReg (A, load, clear, clk, Z);
  input A, load, clear, clk;  output Z;
  wire [7:0] A;   wire load, clear, clk;
  reg  [7:0] Z;
  always @(posedge clk) begin
    if (!clear) begin
      Z = 0;
    end else begin
      if (load) begin
        Z = A;
      end
    end
  end
endmodule

VHDL

entity ParReg is
  port (A : in bit_vector; clk, load, clear : in bit; Z : out bit_vector);
end entity ParReg;
architecture RTL of ParReg is
begin
  L : process (clk)
  begin
    if (rising_edge(clk)) then
      if clear = '0' then
        Z <= (others => '0');
      elsif load = '1' then
        Z <= A;
      end if;
    end if;
  end process;
end architecture RTL;
#verilog#vhdl#behavioral-simulation#synchronous-clear#load-enable#waveform-simulation