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 =

Similar documents
VHDL VHDL VHDL i

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

VHDL

スライド 1

Unconventional HDL Programming ( version) 1

Microsoft PowerPoint LC_15.ppt

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

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

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

Microsoft Word - 実験4_FPGA実験2_2015

論理設計の基礎

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

スライド 1

VBI VBI FM FM FM FM FM DARC DARC

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


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

PeakVHDL Max+Plus VGA VG

卒 業 研 究 報 告

フリップフロップ

LSI LSI 2

FPGA と LUPO その1

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

Verilog HDL による回路設計記述

Design at a higher level

<4D F736F F D2091B28BC68CA48B8695F18D902E646F63>

COINS 5 2.1

RSA FA FA AND Booth FA FA RSA 3 4 5

卒業研究報告.PDF

論理回路設計

論理回路設計

推奨されるHDLコーディング構文

PLDとFPGA

VHDL

論理回路設計

プリント

Łñ“’‘‚2004


main.dvi

untitled

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

橡挿入法の実践

starc_verilog_hdl pptx

回路設計 WEBラボ:10ビットのプチDACをRTLで動かしてみる(おまけソースつき)

main.dvi

Microsoft Word - 卒業論文.doc

プロセッサ・アーキテクチャ

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

Quartus IIネットリスト・ビューワによるデザインの解析


untitled

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

VLD Kazutoshi Kobayashi

LSI LSI

Report Template

ハードウェア・ イーサIPコアを解読する


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

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

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


¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó


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

Time Schedule P.7 P.4-6 P.7 P.7 P.9 P.9 P.8 P.8 P.11 P.11 P.9 Time Schedule 1

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

Lab GPIO_35 GPIO

Microsoft PowerPoint - Lec pptx

y = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f() + f() + f(3) + f(4) () *4

Kazutoshi Kobayashi (kobayasi kit.ac.jp)

橡ソート手順比較

fft 高速フーリエ変換 Data Sheet

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

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

25 II :30 16:00 (1),. Do not open this problem booklet until the start of the examination is announced. (2) 3.. Answer the following 3 proble

strtok-count.eps

9BBH3A8_P0000

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

<4D F736F F F696E74202D C190DD B A CB48D65208E DC58F49205B8CDD8AB B83685D>

, FPGA Verilog-HDL


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

output2010本文.indd

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

Handsout3.ppt

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

2.5. Verilog 19 Z= X + Y - Z A+B LD ADD SUB ST (X<<1)+(Y<<1) X 1 2 LD SL ST 2 10

01

表紙.indd


Compatibility list: vTESTstudio/CANoe

IPSJ SIG Technical Report Vol.2017-ARC-225 No.12 Vol.2017-SLDM-179 No.12 Vol.2017-EMB-44 No /3/9 1 1 RTOS DefensiveZone DefensiveZone MPU RTOS



5 2 5 Stratix IV PLL 2 CMU PLL 1 ALTGX MegaWizard Plug-In Manager Reconfig Alt PLL CMU PLL Channel and TX PLL select/reconfig CMU PLL reconfiguration

Microsoft Word - HW06K doc

STARTプログラム.indd

AN 100: ISPを使用するためのガイドライン

Nios II 簡易チュートリアル

DELPHINUS EQUULEUS 2019 NASA SLS FPGA ( ) DELPHINUS 2

Transcription:

VHDL 2 1 VHDL 1 VHDL FPGA VHDL 2 HDL VHDL 2.1 D 1 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; regs.vhdl entity regs is clk, rst : in std_logic; clear : in std_logic; we : in std_logic; D : in std_logic_vector(7 downto 0); Q : out std_logic_vector(7 downto 0)); end regs; architecture rtl of regs is process (clk, rst) if rst = 0 then Q <= "00000000"; elsif clk event and clk = 1 then 1

if clear = 1 then Q <= "00000000"; elsif we = 1 then Q <= D; end rtl; regs.vhdl clk 0 1 rst clear 0 0 0 we Write Enable we 1 we 0 if clk 1 Q if rst = 0 then -- Q <= "0000"; elsif clk event and clk = 1 then -- rst clear we 2.2 4 8 4 8 clk we 1 adr 3 D 4 Q 4 we 1 adr 0 adr 7 D adr Q 2

regfile.vhdl library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity regfile is clk : in std_logic; we : in std_logic; adr : in std_logic_vector(2 downto 0); D : in std_logic_vector(3 downto 0); Q : out std_logic_vector(3 downto 0)); end entity regfile; architecture behv of regfile is type ramtype is array (0 to 7) of std_logic_vector(3 downto 0); signal mem : ramtype; Q <= mem(conv_integer(adr)); process (clk) is if clk event and clk = 1 then if we = 1 then mem(conv_integer(adr)) <= D; end architecture behv; regfile.vhdl VHDL array 4 8 ramtype ramtype mem 0 7 mem(0) mem(3) adr 3 std logic vector VHDL conv integer() 2.3 0 n 1 2 n 3

10 VHDL count10 clk rst rst 1 0 0 VHDL Q Qreg Q count10.vhdl library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count10 is clk, rst : in std_logic; Q : out std_logic_vector(3 downto 0)); end count10; architecture rtl of count10 is signal Qreg : std_logic_vector(3 downto 0); Q <= Qreg; process (clk, rst) if rst = 0 then Qreg <= "0000"; elsif clk event and clk = 1 then if Qreg = "1001" then Qreg <= "0000"; else Qreg <= Qreg + 1; end rtl; count10.vhdl clk Qreg 1 if if clk event and clk = 1 then Qreg <= Qreg + 1; 4

2.4 clk n 4 load 1 count 1 1 2 Q 4 zero 1 load 1 n load 0 count 1 1 load count 0 Q 0 zero 1 downcounter.vhdl library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity downcounter is clk : in std_logic; n : in std_logic_vector(3 downto 0); load : in std_logic; count : in std_logic; Q : out std_logic_vector(3 downto 0); zero : out std_logic); end entity downcounter; architecture behv of downcounter is signal Qreg : std_logic_vector(3 downto 0); -- Output Q <= Qreg; -- Down counter process (clk) is if clk event and clk = 1 then if load = 1 then Qreg <= n; elsif count = 1 then 5

Qreg <= Qreg - 1; -- zero process (Qreg) is if Qreg = "0000" then zero <= 1 ; else zero <= 0 ; end architecture behv; downcounter.vhdl 3 n 1 n summation 1: sum = 0 2: INPUT n 3: while (n >= 0) 4: { 5: sum = sum + n 6: n = n - 1 7: } 8: OUTPUT sum summation n 1 n n 0 1 6

1 1 n 3.1 2 2 7 clk rst 1 load, count, clear, sumload 1 2 n 4 3 7

sum 1 n 8 cnt 4 zero 0 1 1. 2.4 4 8 Sreg 8 2. load 1 n 3. load 0 count 1 1 4. clear 1 Sreg 0 5. sumload 1 Sreg 6. sum Sreg 7. cval 8. zero 0 1 0 2 *1 datapath.vhdl library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity datapath is clk : in std_logic; rst : in std_logic; load : in std_logic; count : in std_logic; clear : in std_logic; sumload : in std_logic; n : in std_logic_vector(3 downto 0); sum : out std_logic_vector(7 downto 0); cval : out std_logic_vector(3 downto 0); zero : out std_logic); end datapath; architecture rtl of datapath is *1 VHDL 2 8

component regs is clk, rst : in std_logic; clear : in std_logic; we : in std_logic; D : in std_logic_vector(7 downto 0); Q : out std_logic_vector(7 downto 0)); end component regs; component downcounter is clk : in std_logic; n : in std_logic_vector(3 downto 0); load : in std_logic; count : in std_logic; Q : out std_logic_vector(3 downto 0); zero : out std_logic); end component downcounter; -- 8-bits register signal Sreg : std_logic_vector(7 downto 0); -- lines signal addout : std_logic_vector(7 downto 0); signal cnt : std_logic_vector(3 downto 0); DCN0 : downcounter port map ( clk => clk, n => n, load => load, count => count, Q => cnt, zero => zero); -- Output sum <= Sreg; cval <= cnt; -- Sreg 9

SUMREG : regs port map ( clk => clk, rst => rst, clear => clear, we => sumload, D => addout, Q => Sreg); -- Adder process (cnt, Sreg) is addout <= ("0000" & cnt) + Sreg; end architecture rtl; datapath.vhdl 3.2 4 load, count, clear, sumload Finite State Machine FSM 3 1 start 1 zero 1 3 1 3 VHDL controller.vhdl VHDL 1. state 10

1 load count clear sumload done s 0 0 0 1 0 0 s 1 1 0 1 0 0 s 2 0 0 1 0 0 s 3 0 0 0 1 0 s 4 0 1 0 0 0 s 5 0 0 0 0 1 2. state start zero 3. state process controller.vhdl 6 s0 s5 3 constant controller.vhdl library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity controller is clk : in std_logic; rst : in std_logic; start : in std_logic; zero : in std_logic; cur : out std_logic_vector(2 downto 0); load : out std_logic; count : out std_logic; clear : out std_logic; sumload : out std_logic; done : out std_logic); end entity controller; architecture behv of controller is signal state : std_logic_vector(2 downto 0); signal next_state : std_logic_vector(2 downto 0); -- state constant s0 : std_logic_vector(2 downto 0) := "000"; 11

constant s1 : std_logic_vector(2 downto 0) := "001"; constant s2 : std_logic_vector(2 downto 0) := "010"; constant s3 : std_logic_vector(2 downto 0) := "011"; constant s4 : std_logic_vector(2 downto 0) := "100"; constant s5 : std_logic_vector(2 downto 0) := "101"; constant UNKNOWN : std_logic_vector(2 downto 0) := "XXX"; -- output cur <= state; -- Register process (clk, rst) is if rst = 0 then state <= s0; elsif clk event and clk = 1 then state <= next_state; -- calclate next_state process (start, state, zero) is case state is when s0 => if start = 1 then next_state <= s1; else next_state <= s0; -- when others => next_state <= UNKNOWN; end case; -- output from controller process (state) is load <= 0 ; count <= 0 ; sumload <= 0 ; clear <= 0 ; 12

done <= 0 ; case state is when s0 => clear <= 1 ; -- when others => null; end case; end architecture behv; controller.vhdl 4 Quartus II FPGA DE1 VHDL FPGA 4.1 regs.vhdl VHDL DE1 4.2 regfile.vhdl VHDL DE1 4.3 downcounter.vhdl VHDL DE1 4.4 datapath.vhdl DE1 4.5 controller.vhdl DE1 4.6 n 1 n summation datapath controller DE1 13

summation.vhdl entity summation is clk : in std_logic; rst : in std_logic; start : in std_logic; n : in std_logic_vector(3 downto 0); sum : out std_logic_vector(7 downto 0); cval : out std_logic_vector(3 downto 0); load : out std_logic; done : out std_logic); end entity summation; summation.vhdl clk rst start n sum cval load load n done done 5 VHDL 1. 2. URL http://www.mais.cs.gunma-u.ac.jp/lecture/ 14

[1] 1999 [2] VHDL CQ 1995 [3] 2009 [4] Altera University Program, http://www.altera.com/education/univ/unv-index.html. [5] E.O. Hwang, Digital Logic and Microprocessor Design with VHDL, Thomson, Canada, 2006. 15