VHDL

Similar documents
VHDL VHDL VHDL i

論理設計の基礎

if clear = 1 then Q <= " "; elsif we = 1 then Q <= D; end rtl; regs.vhdl clk 0 1 rst clear we Write Enable we 1 we 0 if clk 1 Q if rst =

スライド 1

Unconventional HDL Programming ( version) 1

TECH_I Vol.25 改訂新版PCIデバイス設計入門

Microsoft PowerPoint - 集積回路工学_ ppt[読み取り専用]

starc_verilog_hdl pptx

Verilog HDL による回路設計記述

卒 業 研 究 報 告

VBI VBI FM FM FM FM FM DARC DARC

Microsoft Word - 実験4_FPGA実験2_2015

スライド 1

フリップフロップ

Microsoft PowerPoint LC_15.ppt

エンティティ : インタフェースを定義 entity HLFDD is port (, : in std_logic ;, : out std_logic ) ; end HLFDD ; アーキテクチャ : エンティティの実現 architecture RH1 of HLFDD is <= xor

- VHDL 演習 ( 組み合せ論理回路 ) 回路 半加算器 (half adder,fig.-) 全加算器を構成する要素である半加算器を作成する i) リスト - のコードを理解してから, コンパイル, ダウンロードする ii) 実験基板上のスイッチ W, が, の入力,LED, が, の出力とな

TULを用いたVisual ScalerとTDCの開発


untitled


デザインパフォーマンス向上のためのHDLコーディング法

LSI LSI 2

問 2. タイミングチャート以下に示す VHDL コードで記述されている回路に関するタイミングチャートを完成させよ ) レジスタの動作 use IEEE.std_logic_64.all; entity RegN is generic (N : integer := 8 port ( CLK, EN

PeakVHDL Max+Plus VGA VG

COINS 5 2.1

回路 7 レジスタ ( 同期イネーブル及び非同期リセット付 ) 入力データを保持するのに用いる記憶素子 使用用途として, マイクロプロセッサ内部で演算や実行状態の保持に用いられる Fig4-2 のレジスタは, クロック信号の立ち上がり時かつ 信号が 1 のときに外部からの 1 ビットデータ R をレ

MOSFET 6-2 CMOS 6-2 TTL Transistor Transistor Logic ECL Emitter Coupled Logic I2L Integrated

FPGA と LUPO その1

RSA FA FA AND Booth FA FA RSA 3 4 5


0630-j.ppt

XC9500 ISP CPLD JTAG Port 3 JTAG Controller In-System Programming Controller 8 36 Function Block Macrocells to 8 /GCK /GSR /GTS 3 2 or 4 Blocks FastCO

LSI LSI

Design at a higher level

VHDL-AMS Department of Electrical Engineering, Doshisha University, Tatara, Kyotanabe, Kyoto, Japan TOYOTA Motor Corporation, Susono, Shizuok

PLDとFPGA

VHDL

2ALU 以下はデータ幅 4ビットの ALU の例 加算, 減算,AND,OR の4つの演算を実行する 実際のプロセッサの ALU は, もっと多種類の演算が可能 リスト 7-2 ALU の VHDL 記述 M use IEEE.STD_LOGIC_1164.ALL; 00 : 加算 use IEE

論理回路設計

論理回路設計

「FPGAを用いたプロセッサ検証システムの製作」

<4D F736F F D2091B28BC68CA48B8695F18D902E646F63>

論理回路設計

HardCopy IIデバイスのタイミング制約

( ) : 1997

untitled

VLD Kazutoshi Kobayashi

設計現場からの課題抽出と提言 なぜ開発は遅れるか?その解決策は?

Cyclone IIIデバイスのI/O機能

計数工学実験/システム情報工学実験第一 「ディジタル回路の基礎」

untitled

システムオンチップ技術

Microsoft PowerPoint - Chap1 [Compatibility Mode]

MAX IIデバイスのIEEE (JTAG)バウンダリ・スキャン・テスト


main.dvi

Microsoft PowerPoint - Lec pptx

HardCopy IIIデバイスの外部メモリ・インタフェース

プログラマブル論理デバイス

ディジタル電子回路 設計演習課題

Kazutoshi Kobayashi (kobayasi kit.ac.jp)

B1 Ver ( ), SPICE.,,,,. * : student : jikken. [ ] ( TarouOsaka). (, ) 1 SPICE ( SPICE. *1 OrCAD

LTC ビット、200ksps シリアル・サンプリングADC

1: ITT-2 DDR2 1.8V,.V(F) Config. Mem. JTAG XCFPV048 LEDs SWs Clock (VariClock) DDR2 DDR2 DDR2 FPGA XC5VFX0T General-Purpose LEDs SWs XTAL (2.68kHz) MC

Power Calculator

.,. 0. (MSB). =2, =1/2.,. MSB LSB, LSB MSB. MSB 0 LSB 0 0 P

IEEE (JTAG) Boundary-Scan Testing for Stratix II & Stratix II GX Devices

ネットリストおよびフィジカル・シンセシスの最適化

strtok-count.eps

26 FPGA FPGA (Field Programmable Gate Array) ASIC (Application Specific Integrated Circuit) FPGA FPGA FPGA FPGA Linux FreeDOS skewed way L1

SystemC 2.0を用いた簡易CPUバスモデルの設計

Report Template

Stratix IIIデバイスの外部メモリ・インタフェース

卒業研究報告.PDF

テストコスト抑制のための技術課題-DFTとATEの観点から

VLSI工学

Chip PlannerによるECO

高速データ変換

Arria GXデバイスのIEEE (JTAG)バウンダリ・スキャン・テスト

untitled

3 SIMPLE ver 3.2: SIMPLE (SIxteen-bit MicroProcessor for Laboratory Experiment) 1 16 SIMPLE SIMPLE 2 SIMPLE 2.1 SIMPLE (main memo

VelilogHDL 回路を「言語」で記述する

DELPHINUS EQUULEUS 2019 NASA SLS FPGA ( ) DELPHINUS 2

, FPGA Verilog-HDL

R1EV5801MBシリーズ データシート

Xilinx XAPP485 Spartan-3E FPGA における最大レート 666Mbps でのデシリアライズ、アプリケーション ノート

<91E63589F161>

Handsout3.ppt

untitled

FPGAメモリおよび定数のインシステム・アップデート

MAX1213N EV.J

/ FPGA LSI [1] CDP DDP 2 LSI FPGA PicoProcessor(pP)[2] (STP)[1] DDP 1.27 i

日立評論2008年1月号 : 基盤技術製品

Compatibility list: vTESTstudio/CANoe

スライド 1

Microsoft Word - ②(添付資料)家庭の夏期節電実態調査の結果について

matrox0

BIST LSI LSI LSI (DDP) BIST Ring-STP (BIST) BIST LSI e-shuttle 65nm 12Layer CMOS Cadence Verilog-XL 100MHz 16M Packet/sec LSI 5 1 BIST i

HW-Slides-05.ppt

Transcription:

VHDL 1030192 15 2 10

1 1 2 2 2.1 2 2.2 5 2.3 11 2.3.1 12 2.3.2 12 2.4 12 2.4.1 12 2.4.2 13 2.5 13 2.5.1 13 2.5.2 14 2.6 15 2.6.1 15 2.6.2 16 3 IC 17 3.1 IC 17 3.2 T T L 17 3.3 C M O S 20 3.4 21 i

3.5 21 3.6 6 0 22 3.7 7 22 3.8 25 3.9 26 3.10 27 4 VHDL 34 4.1 VHDL 34 4.2 VHDL 34 4.3 VHDL 35 4.4 VHDL 37 4.4.1 7 37 4.4.2 60, 40 4.4.3 24 47 4.4.4 50 5 58 59 60 61 65 ii

1 IC VHDL 2 3 IC VHDL 5 1

2 2.1 (sequential circuit) input sequence internal state state external input external output 2.1 1 n z1 z2 zm у1 у2 уk 3 2

2.1 2.2. CK A B CK 3

2.2. 2.3 2.4 2.3 4

2.4 2.2 (flip-flop) NAND (feedback loop) 2 SR-FF D-FF JK-FF T-FF SR-FF S R S=1 R=0 ( ) Q(t+1)=1 S=0,R=1 (Q(t+1)=0) S=0 R=0 (Q(t+1)=Q(t)) S=1,R=1 Q(t+1)=S+ R Q(t) S R 0-2.5 5

2.5 - - - = S =1 ( +1)=1 =0 ( +1)= ( ) (delay) Q(t+1)=D CMOS NOT D-FF D-FF 2.6 6

2.6 D-FF JK-FF SR-FF J=K=1 Q(t+1)= Q(t) Q(t+1)=J Q + K Q(t) JK 2.7 7

2.7 JK-FF 2.8 JK 2.8(a) CK, JK CK 8

2.8(b) CK, JK 1 CK 1, (a) (b) 2.8 JK T-FF JK-FF J=K T=1 (Q(t+1)=Q(t)) T=0 (Q(t+1)=Q(t)) Q(t+1)=TQ(t) +T Q(t) T-FF 2.9 9

2.9 T-FF FF FF ( )Q FF FF FF 2.1 0 1 FF (excitation function) D-FF,FF 0 1 2.1 10

2.10, 2.10 2.10 0, 0 0 1 1 0 1 2 W 1 2.3 ( ) (latch) (register) ( ) (read) (write)/ ( ) 11

2.3.1 2 2.3.2 1 1 2 2.11 n n 2 ( ) 2 2.11 n 2.4 (counter) 2.4.1 ( ) 2 12

2.4.2 2 2.5 2.5.1 i xk qi yl 2.5.1(a) xk yl 2.12(b) qi qi 2.5.1 1 (a) (b) 2.12 13

4 2.14 1 4 1 0 2.13 4 2 q1 q4 2 00,01,10,11 4 2.13 4 2.5.2 2.2 2.13 4 1 14

2.2 2.6 2.6.1 (decode) (2 ) ( ) (decoder) 2.14 n 2 n*m 0 1 2.14 2*4 15

2.6.2 (encode) ( ) (encoder) 1 1 ( ) 2.15 2 m*n 1 2.15 D1 D2 D0=D3=0 Q=11 D3 (priority) D0 D3 D1=D2=1 Q=10 D2 2.15 4*2 16

IC TTL transistor transistor logic IC TTL IC TTL IC CMOS IC TTL IC ECL emitter coupled logic ECL TTL IC unipolar transistor MOS IC TTL TTL MOS IC MOS IC CMOS CMOS P MOSFET N MOSFET CMOS 2 17

2 18

3.1 IC 19

20

2 IC 3.4 4,194,304Hz Hz Hz 4,194,304Hz 2 22 22 / 2 Hz IC SN74LS292 D FF 22 3.5 21

5 3.6 60 60 3.2 3.2 60 3.7 7 3.4 LED light emitting diode 3.3 3.3 22

L 3.3 LED 3.3 LED 3.3 7 8 a LED 3.4(a) 3.4(b) 23

3.4 (a) (b) 24

3.8 IC 3.5 RS FF S=0 R=1 Q=1, ( ) Q=1, a R S a S= R=0 Q=0 3.5 NAND 25

3.9 60 0 59 7 74HC246 Hz IC 3.6 3.6 IC 26

3.10 27

28

29

1 30

2 31

3 32

3.7 3.7 33

VHDL. VHDL VHDL Very High Speed Integrated Circuit VHSIC Hardware Description Language HDL 1 3 (1)Behavior ASIC FPGA (2)RTL Register Transfer Level ASIC FPGA (3) ASIC RTL 4. VHDL VHDL VHSIC Very High Speed Integrated Circuit 1981 IC ASIC 3 4 ASIC HDL ASIC 34

1983 VHDL 1985 1986 7.2 ASIC VHDL 1986 IEEE VASG VHDL Analysis Standardization Group 1987 5 LRM Language Reference Manual 12 IEEE Std 1076 1987 IEEE VHDL HDL 1989 VHDL VHDL EDA 4 4.3 HDL HDL ASIC HDL ASIC FPGA Filed Programmable Gate Array PLD Programmable Logic Device 4.1 HDL HDL VHDL VHSIC HDL Verilog HDL UDL/I Unified Design Language for Integrate Circuit SFL Structured Function description Language 4.2 4 4.1 HDL 35

4.2 HDL 36

4.4 VHDL VHDL 7 4.4.1 7 4-7 4 7 0 9 10 15 others XXXXXXX 7 VHDL 4.1 4.1 7 VHDL library ieee; use ieee.std_logic_1164.all; entity DECODER4TO7 is port ( A,B,C,D: in std_logic; Y: out std_logic_vector(6 downto 0) ); end DECODER4TO7; architecture RTL of DECODER4TO7 is signal INDATA : std_logic_vector(3 downto 0); INDATA <= D&C&B&A; process(indata) case INDATA is 37

when "0000" => Y <= "0111111"; --0 when "0001" => Y <= "0000110"; --1 when "0010" => Y <= "1011011"; --2 when "0011" => Y <= "1001111"; --3 when "0100" => Y <= "1100110"; --4 when "0101" => Y <= "1101101"; --5 when "0110" => Y <= "1111101"; --6 when "0111" => Y <= "0100111"; --7 when "1000" => Y <= "1111111"; --8 when "1001" => Y <= "1101111"; --9 when others => Y <= "XXXXXXX"; --X end case; end process; end RTL; 4.1 7 library ieee; use ieee.std_logic_1164.all; use std.textio.all; use work.decoder4to7; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component DECODER4TO7 is port ( A,B,C,D: in std_logic; Y: out std_logic ); end component; 38

signal A,B,C,D: std_logic; signal Y: std_logic_vector(6 downto 0); DUT: DECODER4TO7 port map ( A,B,C,D, Y ); STIMULUS1: process A <= '0'; wait for 20ns; A <= '1'; wait for 20ns; end process STIMULUS1; STIMULUS2: process B <= '0'; wait for 40ns; B <= '1'; wait for 40ns; B <= '0'; wait for 40ns; B <= '1'; wait for 40ns; B <= '0'; wait for 40ns; end process STIMULUS2; STIMULUS3: process C <= '0'; wait for 80ns; C <= '1'; wait for 80ns; C <= '0'; wait for 40ns; end process STIMULUS3; STIMULUS4: process D <= '0'; wait for 160ns; D <= '1'; wait for 40ns; end process STIMULUS4; 39

end stimulus; 4.1 7 4.4.2 60, MIN SEC BCD BCD10 BCD10 60 10 0 5 3 BCD WR BCD10WR BCD WR DATAIN. 6ns BCD WR 1 DATAIN BCD DATAIN BCD 0 BCD 0WR 1 DATAIN BCD 0 CIN BCD BCD 0 CO CIN 59 CIN 1 1 VHDL 4.2 VHDL 4.3. 4.2 60 SEC VHDL library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; 40

entity SEC is port ( ); end SEC; CLK,BCD1WR,BCD10WR,CIN: in std_logic; CO: out std_logic; DATAIN : in std_logic_vector(3 downto 0); sec1 : out std_logic_vector(3 downto 0); sec10 : out std_logic_vector(2 downto 0) architecture RTL of SEC is signal sec1n : std_logic_vector(3 downto 0); signal sec10n : std_logic_vector(2 downto 0); sec1 <= sec1n; sec10 <= sec10n; process(clk,bcd1wr) if(bcd1wr='1') then -- sec1n <= DATAIN; elsif(clk'event and CLK='1') then if(cin='1') then if(sec1n=9) then sec1n <= "0000"; else sec1n <= sec1n + 1; end if; end if; end if; end process; process(clk,bcd10wr) if(bcd10wr='1') then -- sec10n <= DATAIN(2 downto 0); elsif(clk'event and CLK='1') then if(cin='1' and sec1n=9 ) then if(sec10n=5) then 41

sec10n <= "000"; else sec10n <= sec10n + 1; end if; end if; end if; end process; process(sec10n,sec1n,cin) if( CIN='1' and sec1n=9 and sec10n=5 ) then CO <= '1'; else CO <= '0'; end if; end process; end RTL; 4.2 60 SEC library ieee,std; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component SEC is port ( CLK,BCD1WR,BCD10WR,CIN : in std_logic; CO : out std_logic; DATAIN : in std_logic_vector(3 downto 0); 42

); sec1 : out std_logic_vector(3 downto 0); sec10 : out std_logic_vector(2 downto 0) end component; signal CLK,BCD1WR,BCD10WR,CIN : std_logic; signal CO : std_logic; signal DATAIN : std_logic_vector(3 downto 0); signal sec1 : std_logic_vector(3 downto 0); signal sec10 : std_logic_vector(2 downto 0); DUT: SEC port map ( CLK,BCD1WR,BCD10WR,CIN, CO, DATAIN, sec1, sec10 ); process CLK <= '1'; wait for 5ns; CLK <= '0'; wait for 5ns; end process; BCD1WR <= '0','1' after 6 ns, '0' after 7 ns; BCD10WR<= '0','1' after 18 ns, '0' after 19 ns; DATAIN <= "0110", "0101" after 13 ns, "XXXX" after 25 ns; CIN <= '0', '1' after 30 ns; 43

end stimulus;. SEC 4.3 60 MIN VHDL Library IEEE; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity MIN is port ( CLK,MIN1WR,MIN10WR,CIN : in std_logic; CO : out std_logic; DATAIN : in std_logic_vector(3 downto 0); MIN1 : out std_logic_vector(3 downto 0); MIN10 : out std_logic_vector(2 downto 0) ); end MIN; architecture RTL of MIN is signal MIN1N : std_logic_vector(3 downto 0); signal MIN10N : std_logic_vector(2 downto 0); MIN1 <= MIN1N; MIN10 <= MIN10N; process(clk,min1wr) if(min1wr='1') then MIN1N <= DATAIN; elsif(clk'event and CLK='0') then if(cin='1') then 44

if(min1n=9) then MIN1N <= "0000"; else MIN1N <= MIN1N + 1; end if; end if; end if; end process; process(clk,min10wr) if(min10wr='1') then MIN10N <= DATAIN(2 downto 0); elsif(clk'event and CLK='0') then if(cin='1' and MIN1N=9 ) then if(min10n=5) then MIN10N <= "000"; else MIN10N <= MIN10N + 1; end if; end if; end if; end process; process(min10n,min1n,cin) if( CIN='1' and MIN1N=9 and MIN10N=5 ) then else CO <= '1'; CO <= '0'; end if; end process; end RTL; 4.3 60 MIN library ieee,std; use ieee.std_logic_1164.all; 45

use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component MIN is port ( CLK,MIN1WR,MIN10WR,CIN : in std_logic; CO : out std_logic; DATAIN : in std_logic_vector(3 downto 0); MIN1 : out std_logic_vector(3 downto 0); MIN10 : out std_logic_vector(2 downto 0) ); end component; signal CLK,MIN1WR,MIN10WR,CIN : std_logic; signal CO : std_logic; signal DATAIN : std_logic_vector(3 downto 0); signal MIN1 : std_logic_vector(3 downto 0); signal MIN10 : std_logic_vector(2 downto 0); DUT: MIN port map ( CLK,MIN1WR,MIN10WR,CIN, CO, DATAIN, MIN1, MIN10 ); process CLK <= '1'; wait for 5ns; CLK <= '0'; 46

wait for 5ns; end process; MIN1WR <= '0','1' after 6 ns, '0' after 7 ns; MIN10WR<= '0','1' after 18 ns, '0' after 19 ns; DATAIN <= "0110", "0101" after 13 ns, "XXXX" after 25 ns; CIN <= '0', '1' after 30 ns; end stimulus; after 4,2 4,3 after after BCD1WR 0 after 6ns 1 after 7ns 1 1ns 0 4.4.3 24 24 0 23 23 VHDL 4,4 4.3 4,4 24 VHDL library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; 47

entity HOUR2 is port ( ); CLK,RESET CO end HOUR2; : in std_logic; : out std_logic; COUNT : out std_logic_vector(4 downto 0) architecture RTL of HOUR2 is signal COUNT_IN : std_logic_vector(4 downto 0); COUNT <= COUNT_IN; process(clk,reset) if(reset = '1') then COUNT_IN <= "10111"; elsif(clk'event and CLK='0') then if(count_in = "10111") then COUNT_IN <= "00000"; else COUNT_IN <= COUNT_IN + '1'; end if; if(count_in = "10110") then CO <= '1'; else CO <= '0'; 48

end if; end if; end process; end RTL; 4,4 24 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component HOUR2 is port ( CLK,RESET : in std_logic; CO : out std_logic; COUNT : out std_logic_vector(4 downto 0) ); end component; constant CLOCK: time := 20 ns; signal CLK,RESET : std_logic; signal CO : std_logic; signal COUNT : std_logic_vector(4 downto 0); DUT: HOUR2 port map ( CLK=>CLK, RESET=>RESET, CO=>CO, 49

COUNT=>COUNT ); CLOCK1: process CLK<='1'; wait for CLOCK/2; CLK<='0'; wait for CLOCK/2; end process CLOCK1; STIMULUS1: process RESET<='0'; wait for CLOCK/3; RESET<='1'; wait for CLOCK; RESET<='0'; wait; end process STIMULUS1; end stimulus; 4.3 24 4.4.4,, CLK CO_ CLK CO_2 CLK 59 4.4.3 1.86us 23 CLK 1sec CLK 10ns 50

,, VHDL 4,5 4,4 library ieee; use ieee.std_logic_1164.all; 4,5,, VHDL use ieee.std_logic_unsigned.all; entity WATCH is port ( CLK,BCD1WR_1,BCD10WR_1,CIN : in std_logic; RESET : in std_logic; MIN1WR_1,MIN10WR_1 : in std_logic; CO_1 : out std_logic; CO_2 : out std_logic; CO_3 : out std_logic; DATAIN : in std_logic_vector(3 downto 0); SEC1_1 : out std_logic_vector(3 downto 0); SEC10_1 : out std_logic_vector(2 downto 0); MIN1_1 : out std_logic_vector(3 downto 0); MIN10_1 : out std_logic_vector(2 downto 0); COUNT_1 : out std_logic_vector(4 downto 0) ); end WATCH; architecture RTL of WATCH is component SEC port ( CLK,BCD1WR,BCD10WR,CIN : in std_logic; CO : out std_logic; DATAIN : std_logic_vector(3 downto 0); SEC1 : std_logic_vector(3 downto 0); SEC10 : std_logic_vector(2 downto 0) ); end component; component MIN 51

port ( CLK,MIN1WR,MIN10WR,CIN :in std_logic; CO : out std_logic; DATAIN : in std_logic_vector(3 downto 0); MIN1 : out std_logic_vector(3 downto 0); MIN10 : out std_logic_vector(2 downto 0) ); end component; component HOUR2 port ( CLK,RESET :in std_logic; CO :out std_logic; COUNT :out std_logic_vector(4 downto 0) ); end component; U0: SEC port map ( CLK,BCD1WR_1,BCD10WR_1,CIN,CO_1,DATAIN,SEC1_1,SEC10_1); U1: MIN port map ( CO_1,MIN1WR_1,MIN10WR_1,CIN,CO_2,DATAIN,MIN1_1,MIN10_1); U2: HOUR2 port map ( CO_2,RESET,CO_3,COUNT_1); end RTL; library ieee; use ieee.std_logic_1164.all; 4,5,, use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component WATCH is 52

port ( CLK,BCD1WR_1,BCD10WR_1,CIN : in std_logic; ); MIN1WR_1,MIN10WR_1 CO_1 CO_2 CO_3 : out std_logic; : out std_logic; : out std_logic; : in std_logic; DATAIN : in std_logic_vector(3 downto 0); SEC1_1 : out std_logic_vector(3 downto 0); SEC10_1 : out std_logic_vector(2 downto 0); MIN1_1 : out std_logic_vector(3 downto 0); MIN10_1 : out std_logic_vector(2 downto 0); COUNT_1 : out std_logic_vector(4 downto 0); RESET : in std_logic end component; constant CLOCK : time := 10 ns; signal CLK,BCD1WR_1,BCD10WR_1,CIN : std_logic; signal MIN1WR_1,MIN10WR_1 : std_logic; signal CO_1 : std_logic; signal CO_2 : std_logic; signal CO_3 : std_logic; signal DATAIN : std_logic_vector(3 downto 0); signal SEC1_1 : std_logic_vector(3 downto 0); signal SEC10_1 : std_logic_vector(2 downto 0); signal MIN1_1 : std_logic_vector(3 downto 0); signal MIN10_1 : std_logic_vector(2 downto 0); signal COUNT_1 : std_logic_vector(4 downto 0); signal RESET : std_logic; DUT: WATCH port map ( CLK => CLK, RESET => RESET, 53

BCD1WR_1 BCD10WR_1 CIN MIN1WR_1 MIN10WR_1 CO_1 CO_2 CO_3 DATAIN SEC1_1 SEC10_1 MIN1_1 MIN10_1 COUNT_1 ); => BCD1WR_1, => BCD10WR_1, => CIN, => MIN1WR_1, => MIN10WR_1, => CO_1, => CO_2, => CO_3, => DATAIN, => SEC1_1, => SEC10_1, => MIN1_1, => MIN10_1, => COUNT_1 CLOCK1: process clk <= '1'; wait for CLOCK/2; clk <= '0'; wait for CLOCK/2; end process CLOCK1; STIMULUS1 : process RESET<='0'; wait for CLOCK/3; RESET<='1'; wait for CLOCK; RESET<='0'; wait; end process STIMULUS1; BCD1WR_1 <= '0','1' after 6ns, '0' after 7ns; BCD10WR_1 <= '0','1' after 18ns, '0' after 19ns; MIN1WR_1 <= '0','1' after 6ns, '0' after 7ns; 54

MIN10WR_1 <= '0','1' after 18ns, '0' after 19ns; DATAIN <= "0110", "0101" after 13ns, "XXXX" after 25ns; CIN <= '0','1' after 30ns; end stimulus; 55

4,4,, 56

4,4,, 57

VHDL 3 PSpice Pspice 4 VHDL VHDL VHDL 58

59

[1] [2] IC [3] [4]VHDL CQ [5] 60

case case when = = If case 1 when others others 2 case 2 case case is end case when when when to when other VHDL architecture entity component is 61

end component component [ ] [ ] end component architecture port map port map FULL_ADDER U0_S HALF_ADDER A CIN B S S U1_CO 2 FULL_ADDER VHDL FULL_ADDER VHDL library ieee; use ieee.std_logic_1164.all; entity FA is port ( A,B,CIN: in std_logic; 62

); end FA; S,CO: out std_logic architecture STRUCTURE of FA is component HA port ( A,B : in std_logic; S,CO : out std_logic); end component; signal U0_CO,U0_S,U1_CO : std_logic; U0 : HA port map ( A,B,U0_S,U0_CO ); U1 : HA port map ( U0_S,CIN,S,U1_CO ); -- CO <= U0_CO or U1_CO; end STRUCTURE; VHDL VHDL wait wait Wait wait until wait on wait on wait on wait on 63

wait Wait 1 1 wait wait on wait until wait for wait 64

VHDL 4 1980 19 80 1 0 VHDL, VHDL library ieee; use ieee.std_logic_unsigned.all; use ieee.std_logic_1164.all; entity DAYMONTH is port ( CLK,RESET : in std_logic; DAY : out std_logic_vector(4 downto 0); MONTH : out std_logic_vector(3 downto 0); CO : out std_logic ); end DAYMONTH; architecture RTL of DAYMONTH is signal NICHI : std_logic_vector(4 downto 0); signal TUKI : std_logic_vector(3 downto 0); DAY <= NICHI; MONTH <= TUKI; process(reset,clk) 65

if (RESET='1') then TUKI <= "0001"; NICHI <= "00000"; elsif(clk'event and CLK='1') then if(tuki= "0001" or TUKI= "0011" or TUKI= "0101" or TUKI= "0111" or TUKI= "1000" or TUKI= "1010" ) then if(nichi="11111")then NICHI <= "00001"; TUKI <= TUKI + '1'; CO <= '0'; else NICHI<=NICHI+'1'; CO <= '0'; end if; elsif(tuki="0010") then if(nichi="11100") then NICHI <= "00001"; TUKI <= TUKI + '1'; CO <= '0'; else NICHI <= NICHI + '1'; CO <= '0'; end if; elsif(tuki="1100") then if(nichi="11111") then NICHI <= "00001"; TUKI <= "0001"; CO <= '1'; else NICHI <= NICHI+'1'; CO <= '0'; end if; else if(nichi="11110")then 66

end if; end if; end process; NICHI <= "00001"; TUKI <= TUKI + '1'; CO else <= '0'; NICHI <= NICHI + '1'; CO end if; <= '0'; end RTL; library ieee; use ieee.std_logic_1164.all; use std.textio.all; use work.cale; entity TESTBNCH is end TESTBNCH; architecture STIMULUS of TESTBNCH is component DAYMONTH is port ( CLK : in std_logic; RESET : in std_logic; DAY : out std_logic_vector(4 downto 0); MONTH : out std_logic_vector(3 downto 0); CO : out std_logic ); end component; constant CLOCK : time := 10 ns; 67

signal CLK : std_logic; signal RESET : std_logic; signal DAY : std_logic_vector(4 downto 0); signal MONTH : std_logic_vector(3 downto 0); signal CO : std_logic; DUT: DAYMONTH port map ( CLK => CLK, RESET => RESET, DAY => DAY, MONTH => MONTH, CO => CO ); STIMULUS2:process CLK<='0'; wait for CLOCK; CLK<='1'; wait for CLOCK; end process STIMULUS2; STIMULUS3:process RESET<='0';wait for 3ns; RESET<='1';wait for 6ns; RESET<='0';wait; end process STIMULUS3; end STIMULUS; VHDL 68

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity YEAR_DOWN is port ( CLK,RESET : in std_logic; YEAR_D : out std_logic_vector(6 downto 0); YEAR_D_OUT : out std_logic ); end YEAR_DOWN; architecture RTL of YEAR_DOWN is signal YEAR_D_IN : std_logic_vector(6 downto 0); YEAR_D <= YEAR_D_IN; process(clk,reset) if(reset='1') then YEAR_D_IN <= "0000000"; YEAR_D_OUT<= '0'; elsif(clk'event and CLK='1') then if(year_d_in = "1100011") then YEAR_D_IN <= "0000000"; YEAR_D_OUT<= '1'; else YEAR_D_IN <= YEAR_D_IN + 1; YEAR_D_OUT<= '0'; end if; end if; 69

end process; end RTL; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component YEAR_DOWN is port ( CLK,RESET: in std_logic; YEAR_D: out std_logic ); end component; constant PERIOD: time := 20 ns; signal CLK,RESET: std_logic; signal YEAR_D: std_logic_vector(6 downto 0); DUT: YEAR_DOWN port map ( CLK=>CLK, RESET=>RESET, YEAR_D=>YEAR_D ); CLOCK1: process 70

clk<='1'; wait for PERIOD/2; clk<='0'; wait for PERIOD/2; end process CLOCK1; STIMULUS1: process RESET<='0'; wait for PERIOD/3; RESET<='1'; wait for PERIOD; RESET<='0'; wait; end process STIMULUS1; end stimulus; VHDL library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity YEAR_UP is port ( CLK,RESET : in std_logic; YEAR_U : out std_logic_vector(6 downto 0) ); end YEAR_UP; architecture RTL of YEAR_UP is signal YEAR_U_IN : std_logic_vector(6 downto 0); YEAR_U <= YEAR_U_IN; process(clk,reset) if(reset='1') then YEAR_U_IN <= "0000000"; 71

elsif(clk'event and CLK='1') then if(year_u_in = "1100011") then YEAR_U_IN <= "0000000"; else YEAR_U_IN <= YEAR_U_IN + 1; end if; end if; end process; end RTL; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component YEAR_UP is port ( CLK,RESET: in std_logic; YEAR_U: out std_logic ); end component; constant PERIOD: time := 20 ns; signal CLK,RESET: std_logic; signal YEAR_U: std_logic_vector(6 downto 0); 72

DUT: YEAR_UP port map ( ); CLK=>CLK, RESET=>RESET, YEAR_U=>YEAR_U CLOCK1: process clk<='1'; wait for PERIOD/2; clk<='0'; wait for PERIOD/2; end process CLOCK1; STIMULUS1: process RESET<='0'; wait for PERIOD/3; RESET<='1'; wait for PERIOD; RESET<='0'; wait; end process STIMULUS1; end stimulus; 73

VHDL library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity TOTALcale is port ( CLK,RESET : in std_logic; DAY_1 : out std_logic_vector(4 downto 0); MONTH_1 : out std_logic_vector(3 downto 0); CO_1 : out std_logic; YEAR_D1 : out std_logic_vector(6 downto 0); YEAR_D_OUT1 : out std_logic; YEAR_UP1 : out std_logic_vector(6 downto 0) ); end TOTALcale; architecture RTL of TOTALcale is component DAYMONTH port ( CLK,RESET : in std_logic; DAY : out std_logic_vector(4 downto 0); MONTH : out std_logic_vector(3 downto 0); CO : out std_logic ); end component; component YEAR_DOWN port ( CLK,RESET : in std_logic; YEAR_D : out std_logic_vector(6 downto 0); YEAR_D_OUT : out std_logic ); end component; 74

component YEAR_UP port ( ); CLK,RESET : in std_logic; YEAR_U : out std_logic_vector(6 downto 0) end component; U0: DAYMONTH port map ( CLK, RESET, DAY_1, MONTH_1, CO_1); U1: YEAR_DOWN port map ( CO_1, RESET, YEAR_D1, YEAR_D_OUT1); U2: YEAR_UP port map ( YEAR_D_OUT1, RESET, YEAR_UP1); end RTL;,, library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity TESTBNCH is end TESTBNCH; architecture stimulus of TESTBNCH is component TOTALcale is port ( CLK,RESET : in std_logic; DAY_1 : out std_logic_vector(4 downto 0); MONTH_1 : out std_logic_vector(3 downto 0); CO_1 : out std_logic; YEAR_D1 : out std_logic_vector(6 downto 0); YEAR_D_OUT1 : out std_logic; YEAR_UP1 : out std_logic_vector(6 downto 0) ); end component; constant PERIOD: time := 20 ns; 75

signal CLK,RESET : std_logic; signal DAY_1 : std_logic_vector(4 downto 0); signal MONTH_1 : std_logic_vector(3 downto 0); signal CO_1 : std_logic; signal YEAR_D1 : std_logic_vector(6 downto 0); signal YEAR_D_OUT1 : std_logic; signal YEAR_UP1 : std_logic_vector(6 downto 0); DUT: TOTALcale port map ( CLK => CLK, RESET => RESET, DAY_1 => DAY_1, MONTH_1 => MONTH_1, CO_1 => CO_1, YEAR_D1 => YEAR_D1, YEAR_D_OUT1 => YEAR_D_OUT1, YEAR_UP1 => YEAR_UP1 ); CLOCK1: process clk<='1'; wait for PERIOD/2; clk<='0'; wait for PERIOD/2; end process CLOCK1; STIMULUS1: process RESET<='0'; wait for 3 ns; RESET<='1'; wait for 17 ns; RESET<='0'; wait; end process STIMULUS1; end stimulus; 76