HDLBits - Vector1

2024. 12. 12. 23:33·HDLBits/Verilog

Vector 선언

type [upper:lower] vector_name;

Implict Nets - 암시적 Nets 방지하기

`default_nettype none

Packed Array

  • reg 타입 256-bit mem 변수를 총 8개 선언한 것
    reg [7:0] mem [255:0]

  • Vector assign
    wire [7:0] w;와 output [3:0] a가 있을때
    assign w = a;를 하면 8-bit w wire에 4-bit a가 할당된다고 보면된다.
    bit수가 다를때 빈자리는 0으로 채워지고 모자란다면 잘려진다.

설명은 여기서 끝이고
이제 문제를 보자

Build a combinational circuit that splits an input half-word (16 bits, [15:0] ) into lower [7:0] and upper [15:8] bytes.

Combinational 회로를 만들어라 / half-word인 input을 lower 8bit upper 8bit으로 쪼개서 output해라 라는 문제이다.

간단히 in[15:8]과 in[7:0]으로 나누고 assign하면 된다.

`default_nettype none     // Disable implicit nets. Reduces some types of bugs.
module top_module( 
    input wire [15:0] in,
    output wire [7:0] out_hi,
    output wire [7:0] out_lo 
);
    assign out_hi = in[15:8];
    assign out_lo = in[ 7:0];

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

    • 홈
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

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

  • 최근 글

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

티스토리툴바