HDLBits - Gates4

2024. 12. 17. 13:35·HDLBits/Verilog

Build a combinational circuit with four inputs, in[3:0]

There are 3 outputs:

out_and: output of a 4-input AND gate.
out_or: output of a 4-input OR gate.
out_xor: output of a 4-input XOR gate.

3개의 Output을 위에서 말하는 Gate들로 만드는 문제
Bit들을 하나씩 떨어뜨리고 연산하면 끝

module top_module( 
    input [3:0] in,
    output out_and,
    output out_or,
    output out_xor
);
    assign out_and = in[0] & in[1] & in[2] & in[3];
    assign out_or  = in[0] | in[1] | in[2] | in[3];
    assign out_xor = in[0] ^ in[1] ^ in[2] ^ in[3];

endmodule
저작자표시 비영리 변경금지 (새창열림)
'HDLBits/Verilog' 카테고리의 다른 글
  • HDLBits - Vector4
  • HDLBits - Vectorr
  • HDLBits - Vectorgates
  • HDLBits-Vector2
Zi_Yoon
Zi_Yoon
머리 속에 정리하는 곳 <전자공학>
  • Zi_Yoon
    ZY_repo
    Zi_Yoon
  • 전체
    오늘
    어제
    • 분류 전체보기 (70)
      • HDLBits (25)
        • Verilog (19)
        • Circuits (4)
        • Verification (0)
      • IDEC 교육 (1)
        • Embedded C (13)
        • Verilog HDL (8)
      • Hardware (8)
        • RISC-V Project (1)
        • Computer Architecture (0)
        • AMBA (2)
        • FPGA (0)
        • 논문 읽기 (1)
        • ETC. (4)
      • 42서울 (13)
        • 리눅스 (12)
        • 네트워크 (1)
      • 생각 (1)
      • 취업 (1)
  • 블로그 메뉴

    • 홈
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    lsblk
    signal trap
    charater
    보안 쉘
    AppArmor
    세션 키
    axi
    fpga
    research rabbit
    verilator
    ARM
    비대칭 키
    verilog
    centos
    IDEC
    vm
    AMBA
    AXI4
    hdlbits
    ssh
    embedded
    debian
    fucntion
    bit-wise and
    RISC-V
    QUARTUS
    Keil
    APT
    c
    pointer
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.1
Zi_Yoon
HDLBits - Gates4
상단으로

티스토리툴바