[FPGA] gate

2022. 10. 5. 04:15· FPGA
반응형

github

 

GitHub - kyw6416/FPGA_gates: AND, NAND, OR, NOR, XOR, NOT

AND, NAND, OR, NOR, XOR, NOT. Contribute to kyw6416/FPGA_gates development by creating an account on GitHub.

github.com

 

Design source

`timescale 1ns / 1ps

module gate(
    input i_switch_0,
    input i_switch_1,

    output o_and, o_nand, o_or, o_nor, o_xor, o_not
);

    assign o_and  =   i_switch_0 & i_switch_1;
    assign o_nand = ~(i_switch_0 & i_switch_1);
    assign o_or   =   i_switch_0 | i_switch_1;
    assign o_nor  = ~(i_switch_0 | i_switch_1);
    assign o_xor  =   i_switch_0 ^ i_switch_1;
    assign o_not  =  ~i_switch_0;

endmodule

schematic

simulation source

`timescale 1ns / 1ps

// Test Bench

module tb_gate();

    reg i_switch_0, i_switch_1;
    wire o_and, o_nand, o_nor, o_not, o_or, o_xor;

    gate dut(
    .i_switch_0(i_switch_0),
    .i_switch_1(i_switch_1),

    .o_and(o_and),
    .o_nand(o_nand),
    .o_or(o_or),
    .o_nor(o_nor),
    .o_xor(o_xor),
    .o_not(o_not)
    
    );

    initial begin
        #00 i_switch_0 = 1'b0; i_switch_1 = 1'b0;
        #10 i_switch_0 = 1'b0; i_switch_1 = 1'b1;
        #10 i_switch_0 = 1'b1; i_switch_1 = 1'b0;
        #10 i_switch_0 = 1'b1; i_switch_1 = 1'b1;
        #10 $finish;
    end

endmodule

timing chart

constraints

## Switches

set_property -dict { PACKAGE_PIN V17  IOSTANDARD LVCMOS33 } [get_ports { i_switch_0  }]; #IO_L19N_T3_A09_D25_VREF_14 ,Sch=SW0
set_property -dict { PACKAGE_PIN V16  IOSTANDARD LVCMOS33 } [get_ports { i_switch_1  }]; #IO_L19P_T3_A10_D26_14      ,Sch=SW1

## LEDs

set_property -dict { PACKAGE_PIN U16  IOSTANDARD LVCMOS33 } [get_ports { o_and  }]; #IO_L23N_T3_A02_D18_14        ,Sch=LED0
set_property -dict { PACKAGE_PIN E19  IOSTANDARD LVCMOS33 } [get_ports { o_nand  }]; #IO_L3N_T0_DQS_EMCCLK_14      ,Sch=LED1
set_property -dict { PACKAGE_PIN U19  IOSTANDARD LVCMOS33 } [get_ports { o_or  }]; #IO_L15P_T2_DQS_RDWR_B_14     ,Sch=LED2
set_property -dict { PACKAGE_PIN V19  IOSTANDARD LVCMOS33 } [get_ports { o_nor  }]; #IO_L15N_T2_DQS_DOUT_CSO_B_14 ,Sch=LED3
set_property -dict { PACKAGE_PIN W18  IOSTANDARD LVCMOS33 } [get_ports { o_xor  }]; #IO_L16P_T2_CSI_B_14          ,Sch=LED4
set_property -dict { PACKAGE_PIN U15  IOSTANDARD LVCMOS33 } [get_ports { o_not  }]; #IO_L23P_T3_A03_D19_14        ,Sch=LED5

## Configuration options, can be used for all designs
set_property CONFIG_VOLTAGE 3.3 [current_design]
set_property CFGBVS VCCO [current_design]

 

작동사진

i_switch_0 = 0, i_switch_1 = 0
i_switch_0 = 0, i_switch_1 = 1
i_switch_0 = 1, i_switch_1 = 0
i_switch_0 = 1, i_switch_1 = 1

 

반응형
'FPGA' 카테고리의 다른 글
  • [FPGA] 전가산기
  • [FPGA] 반가산기
  • vivado 사용법
  • system ic 설계
kyw6416
kyw6416
kyw6416
kyw6416
kyw6416
전체
오늘
어제
  • 분류 전체보기 (103)
    • PCB 설계 (16)
    • C언어 (6)
    • FPGA (15)
    • 하드웨어_ETC (0)
    • 임베디드_ETC (2)
      • 임베디드_통신 (1)
    • Qt Creator (4)
    • Tool (1)
      • Verdi (1)
    • Verilog (9)
      • i2s (5)
      • hdlbits (0)
    • DRAM (15)
      • DDR2 SDRAM (8)
      • DDR3 SDRAM (0)
      • DDR5 SDRAM (3)
    • DDR PHY (6)
      • DDR PHY 2.1 (6)
    • Makefile (10)
    • Vim (17)
    • 노션 (2)
    • SoC 설계 (0)
반응형
kyw6416
[FPGA] gate
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.