HDLBits - Vector5

2025. 1. 7. 19:48·HDLBits/Verilog

주어진 5개의 1-bit 신호를 XNOR 연산을 통해

https://hdlbits.01xz.net/wiki/Vector5

주어진 그림과 같이 연산하여 25-bit의 출력으로 나타내는 문제이다.

항상 코드의 범용성과 가독성을 고려해서 작성하려고 노력하는 편이다.
이번에도 그렇게 짜려고 wire을 일부러 선언하여 사용했다.

module top_module (
    input a, b, c, d, e,
    output [24:0] out );//

    wire [4:0] w_abcde = {a, b, c, d, e};

    wire [4:0] w_xnor_a = ~{5{a}} ^ w_abcde;
    wire [4:0] w_xnor_b = ~{5{b}} ^ w_abcde;
    wire [4:0] w_xnor_c = ~{5{c}} ^ w_abcde;
    wire [4:0] w_xnor_d = ~{5{d}} ^ w_abcde;
    wire [4:0] w_xnor_e = ~{5{e}} ^ w_abcde;

    assign out = {w_xnor_a, w_xnor_b, w_xnor_c, w_xnor_d, w_xnor_e};

endmodule
저작자표시 비영리 변경금지 (새창열림)
'HDLBits/Verilog' 카테고리의 다른 글
  • HDLBits - Module
  • HDLBits - GitHub 주소
  • HDLBits - Vector4
  • HDLBits - Vectorr
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)
  • 블로그 메뉴

    • 홈
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

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

  • 최근 글

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

티스토리툴바