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
ZY
ZY
전자공학/반도체설계 지식을 정리합니다.
  • ZY
    ZY_repo
    ZY
  • 전체
    오늘
    어제
    • 분류 전체보기 (74)
      • Hardware (11)
        • RTL (2)
        • RISC-V Project (1)
        • Computer Architecture (1)
        • AMBA (2)
        • FPGA (0)
        • 논문 읽기 (1)
        • ETC. (4)
      • Linux (2)
      • EDA Tool (0)
      • HDLBits (25)
        • Verilog (19)
        • Circuits (4)
        • Verification (0)
      • IDEC 교육 (22)
        • Embedded C (13)
        • Verilog HDL (9)
      • 42서울 (13)
        • 리눅스 (12)
        • 네트워크 (1)
      • 생각 (1)
      • 취업 (0)
  • 블로그 메뉴

    • 홈
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    tcsh
    보안 쉘
    fpga
    QUARTUS
    IDEC
    Keil
    Synchronizer
    ssh
    Memory
    vm
    APT
    embedded
    CDC
    hdlbits
    signal trap
    verilog
    pointer
    AXI4
    axi
    centos
    debian
    research rabbit
    세션 키
    c
    verilator
    fucntion
    bit-wise and
    charater
    ARM
    AMBA
  • 최근 댓글

  • 최근 글

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

티스토리툴바