12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

Similar documents
ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Digital Design with VHDL

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

VHDL GUIDELINES FOR SYNTHESIS

An Example VHDL Application for the TM-4

VGA video signal generation

In this example the length of the vector is determined by D length and used for the index variable.

Using Xilinx ISE for VHDL Based Design

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

VHDL programmering H2

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

CPE 462 VHDL: Simulation and Synthesis

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

A CPLD VHDL Introduction

Lab 7: VHDL 16-Bit Shifter

Systems I: Computer Organization and Architecture

VHDL Test Bench Tutorial

! " # # $ '"() * #! +, # / $0123$

Hardware Implementation of the Stone Metamorphic Cipher

More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.

Quartus II Introduction for VHDL Users

Digital Design with Synthesizable VHDL

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

Asynchronous & Synchronous Reset Design Techniques - Part Deux

Digital Systems Design. VGA Video Display Generation

Sprites in Block ROM

Finite State Machine Design and VHDL Coding Techniques

Chapter 8. Sequential Circuits for Registers and Counters

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

State Machines in VHDL

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Digital Design and Synthesis INTRODUCTION

Asynchronous Counters. Asynchronous Counters

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Counters. Present State Next State A B A B

Counters & Shift Registers Chapter 8 of R.P Jain

From VHDL to FPGA

SELECT INPUTS STROBE OUTPUTS

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

Cascaded Counters. Page 1 BYU

Start Active-HDL by double clicking on the Active-HDL Icon (windows).

Introduction to Programmable Logic Devices. John Coughlan RAL Technology Department Detector & Electronics Division

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

EC313 - VHDL State Machine Example

The Designer's Guide to VHDL

Module 3: Floyd, Digital Fundamental

Design: a mod-8 Counter

Two Binary Algorithms for Calculating the Jacobi Symbol and a Fast Systolic Implementation in Hardware

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

Floating point package user s guide By David Bishop (dbishop@vhdl.org)

Lecture 8: Synchronous Digital Systems

Digital Logic Design Sequential circuits

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

FINITE STATE MACHINE: PRINCIPLE AND PRACTICE

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

Lesson 12 Sequential Circuits: Flip-Flops

The components. E3: Digital electronics. Goals:

NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY

Modeling Latches and Flip-flops

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

Printed Circuit Board Design with HDL Designer

List of Experiment. 8. To study and verify the BCD to Seven Segments DECODER.(IC-7447).

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

AES (Rijndael) IP-Cores

ASYNCHRONOUS COUNTERS

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

KCPSM6 Instruction Set

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Application Note 120 Communicating Through the 1-Wire Master

Memory Elements. Combinational logic cannot remember

6. Control Structures

Rotary Encoder Interface for Spartan-3E Starter Kit

Using Altera MAX Series as Microcontroller I/O Expanders

Clock Data Recovery Design Techniques for E1/T1 Based on Direct Digital Synthesis Author: Paolo Novellini and Giovanni Guasti

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Designing Digital Circuits a modern approach. Jonathan Turner

Getting Started Using Mentor Graphic s ModelSim

Chapter 2 Ensuring RTL Intent

VENDING MACHINE. ECE261 Project Proposal Presentaion. Members: ZHANG,Yulin CHEN, Zhe ZHANG,Yanni ZHANG,Yayuan

Chapter 13: Verification

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

Laboratorio di Sistemi Digitali M A.A. 2010/11

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

Finite State Machine. RTL Hardware Design by P. Chu. Chapter 10 1

Chapter 9 Latches, Flip-Flops, and Timers

Flip-Flops, Registers, Counters, and a Simple Processor

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Lecture-3 MEMORY: Development of Memory:

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

Combining the ADS1202 with an FPGA Digital Filter for Current Measurement in Motor Control Applications

Serial port interface for microcontroller embedded into integrated power meter

Transcription:

2..,.,.. Flip-Flops :, Flip-Flops, Flip Flop. ( MOD)... -8 8, 7 ( ).. n Flip-Flops. n Flip-Flops : 2 n. 2 n, Modulo. (-5) -4 ( -), (-) - ( -).. / A A A 2 3 4 5 MOD-5 6 MOD-6 7 MOD-7 8 9 / A A A 2 3 4 5 6 7 8 MOD-8 9 MOD-9 MOD-.. :. (-). 2. n ( 2 n ) FF.. SR PETr / NETr ( ) ( ). 3. ( ) FF ( ). 4. FF,,,. (, FF). 5. () FF. 2. -8 -FF NETr -8 -FF NETr (,

FF ).. :. -8 ( -7). 2. 2 n = 8 n = 3 FF ( -FF NETr). 3. FF. / (..) A A + (..) + + A A FF 2 3 4 5 6 7 2. -8. FF FF ( ). (L) FF : A =, A =X A-FF =, =X -FF =, =X -FF..,,. (, ).... FF. :. A A X X X X X X X X A =. A =. A A X X X X X X X X = = A A X X X X X X X X = = 5. (...) FF. ( ). and H P A Q 4 2 P Q H P Q 2 4. FF. P Q Q Q

3. - 8 -FF. 3.,7,4,2,5,3 ( ) -FF NETr,7,4,2,5,3 ( ) -FF NETr.. /.... FF A A + + + 7 4 2 5 3 X X D D D D D D 6 D D D D D D 3.,7,4,2,5,3..,,7,4,2,5,3. 2. 2 n 7 ( 2 n ) n = 3 FF ( -FF NETr). 3. FF. 4. FF.,.,6. ( ).... FF. A A FF. A A D X X X D D X D D X A = A = A A X D X D X D X X D = = A A D X X D X D X X X D = A = 5. (...) FF. ( ). 4..,7,4,2,5,3 FLIP-FLOP 2. mod- Flip-Flops. 3., 6, 3, 7,, 2, 5 Flip- Flops. 4. MOD-8 --, State Editor..

Finite State Machine (FSM) Editor. FSM.. FileNew, 2.. L reset. q 3bits. 2. 3. FSM Editor, (S,,S8), 3. FSM Editor, VHDL,. vhd, File Export (VHDL code). -- Generated : /6/23 5:5:49 PM library IEEE use IEEE.std_logic_64.all use IEEE.std_logic_arith.all use IEEE.std_logic_unsigned.all entity SAMPLE is port ( reset: in std_logic L: in std_logic q: out std_logic_vector ( 2 downto )) end architecture SAMPLE_arch of SAMPLE is -- SYMOLI ENODED state machine: SMachine type SMachine_type is (S,S2,S3,S4,S5,S6,S7,S8) signal SMachine: SMachine_type := S begin -- concurrent signals assignments -------------------------------------------------- ----- -- Machine: SMachine -------------------------------------------------- ----- SMachine_machine: process (L) begin if reset='' then SMachine <= S elsif L'event and L = '' then -- Set default values for registered outputs/signals and for variables case SMachine is when S => q<="" if reset='' then SMachine <= S2 end if when S2 => q<="" if reset='' then SMachine <= S elsif reset=''then SMachine <= S3 end if when S3 => q<="" if reset='' then SMachine <= S elsif reset=''then SMachine <= S4 end if when S4 => q<="" if reset='' then SMachine <= S elsif reset=''then SMachine <= S5 end if when S5 => q<="" if reset='' then SMachine <= S elsif reset=''then SMachine <= S6 end if when S6 => q<="" if reset='' then SMachine <= S elsif reset=''then 4

5 SMachine <= S7 end if when S7 => q<="" if reset='' then SMachine <= S elsif reset=''then SMachine <= S8 end if when S8 => q<="" if reset='' then SMachine <= S elsif reset=''then SMachine <= S end if when others => null end case end if end process end SAMPLE_arch. Tools New Macro Wizard. 4. Macro Name, ounter. From File counter.vhd, VHDL. 5. Next, 5 TSM. Save. 6. Insert, 7. 4. U ounter 6. reset clk ounter q 7. 8. Pin us Pin Meters Voltage Pin, q 3bits.

6 H L clk k Reset 8. U ounter reset clk ounter q q. VHDL ounterb.vhd, Tools New Macro VHDL. Analysis Digital VHDL Simulation,. VHDL. bit. FSM Editor ounter File Edit Ports. 9, bits q2, q, q.. H L T H q2 q clk k L H Reset. U2 ounterb reset clk ounterb q2 q q q2 q q q2 q q L H q L. 2.m 4.m 6.m 8.m Time (s). VHDL. IF q2<='' q<='' q<='' 9. S S2 S3 S4 q2<='' q2<='' q<='' q<='' q<='' q<='' q2<='' q<='' q<='' q2<='' q<='' q<='' S5 S6 S7 S8 q2<='' q2<='' q<='' q<='' q<='' q<='' q2<='' q<='' q<='' - (-->9-->). bit (clk) 4-bit (digit). IF. temp 4 Flip-Flops 4-bit. LIRARY ieee USE ieee.std_logic_64.all

7 ENTITY counter IS PORT (clk : IN STD_LOGI digit : OUT INTEGER RANGE TO 9) END counter, 7 segment display (SSD) ARHITETURE counter OF counter IS count: PROESS(clk) VARIALE temp : INTEGER RANGE TO IF (clk'event AND clk='') THEN temp := temp + IF (temp=) THEN temp := digit <= temp END PROESS count END counter reset temp ( toy digit). temp 4-bit.. WAIT UNTIL LIRARY ieee USE ieee.std_logic_64.all ENTITY counter IS PORT (clk : IN STD_LOGI digit : OUT INTEGER RANGE TO 9) END counter ARHITETURE counter OF counter IS PROESS -- no sensitivity list VARIALE temp : INTEGER RANGE TO WAIT UNTIL (clk'event AND clk='') temp := temp + IF (temp=) THEN temp := digit <= temp END counter LIRARY ieee USE ieee.std_logic_64.all ENTITY counter IS PORT (clk, reset : IN STD_LOGI digit, digit2 : OUT STD_LOGI_VETOR (6 DOWNTO )) END counter ARHITETURE counter OF counter IS PROESS(clk, reset) VARIALE temp: INTEGER RANGE TO VARIALE temp2: INTEGER RANGE TO IF (reset='') THEN temp := temp2 := ELSIF (clk'event AND clk='') THEN temp := temp + IF (temp=) THEN temp := temp2 := temp2 + IF (temp2=) THEN temp2 := ---- D to SSD conversion: -----

ASE temp IS WHEN => digit <= "" --7E WHEN => digit <= "" --3 WHEN 2 => digit <= "" --6D WHEN 3 => digit <= "" --79 WHEN 4 => digit <= "" --33 WHEN 5 => digit <= "" --5 WHEN 6 => digit <= "" --5F WHEN 7 => digit <= "" --7 WHEN 8 => digit <= "" --7F WHEN 9 => digit <= "" --7 WHEN OTHERS => NULL END ASE ASE temp2 IS WHEN => digit2 <= "" --7E WHEN => digit2 <= "" --3 WHEN 2 => digit2 <= "" --6D WHEN 3 => digit2 <= "" --79 WHEN 4 => digit2 <= "" --33 WHEN 5 => digit2 <= "" --5 WHEN 6 => digit2 <= "" --5F WHEN 7 => digit2 <= "" --7 WHEN 8 => digit2 <= "" --7F WHEN 9 => digit2 <= "" --7 WHEN OTHERS => NULL END ASE END counter FOR/LOOP: FOR i IN TO 5 LOOP x(i) <= enable AND w(i+2) y(, i) <= w(i) END LOOP FOR/LOOP ( GENERATE),... FOR I IN TO HOIE LOOP, HOIE ( ),. WHILE/LOOP: WHILE (i < ) LOOP WAIT UNTIL clk'event AND clk='' (other statements) END LOOP EXIT:, EXIT, (, LOOP ). : FOR i IN data'range LOOP ASE data(i) IS WHEN '' => count:=count+ WHEN OTHERS => EXIT END ASE END LOOP NEXT: NEXT LOOP i=skip: FOR i IN TO 5 LOOP NEXT WHEN i=skip -- jumps to next iteration (...) END LOOP arry Ripple Adder generic, bits. 8bit. FOR/LOOP, IF. --Solution : Generic, with VETORS LIRARY ieee USE ieee.std_logic_64.all ENTITY adder IS GENERI (length : INTEGER := 8) PORT ( a, b: IN STD_LOGI_VETOR (length- DOWNTO ) cin: IN STD_LOGI s: OUT STD_LOGI_VETOR (length- DOWNTO ) cout: OUT STD_LOGI) END adder ARHITETURE adder OF adder IS PROESS (a, b, cin) 8

9 VARIALE carry : STD_LOGI_VETOR (length DOWNTO ) carry() := cin FOR i IN TO length- LOOP s(i) <= a(i) XOR b(i) XOR carry(i) carry(i+) := (a(i) AND b(i)) OR (a(i) AND carry(i)) OR (b(i) AND carry(i)) END LOOP cout <= carry(length) END adder --Solution 2: non-generic, --with INTEGERS LIRARY ieee USE ieee.std_logic_64.all ENTITY adder IS PORT ( a, b: IN INTEGER RANGE TO 255 c: IN STD_LOGI s: OUT INTEGER RANGE TO 255 c8: OUT STD_LOGI) END adder ARHITETURE adder OF adder IS PROESS (a, b, c) VARIALE temp : INTEGER RANGE TO 5 IF (c='') THEN temp:= ELSE temp:= temp := a + b + temp IF (temp > 255) THEN c8 <= '' temp := temp---256 ELSE c8 <= '' s <= temp END adder (ad clocking) () ( ). (.. PLDs) flip-flop. «signal does not hold value after clock edge». ( ). : PROESS (clk) IF(clk'EVENT AND clk='') THEN counter <= counter + ELSIF(clk'EVENT AND clk='') THEN counter <= counter +...,, counter.,. EVENT. IF(clk'EVENT AND clk=''), IF(clk'EVENT), (.. AND clk=') : clock not locally stable.,. : PROESS (clk) IF(clk'EVENT) THEN counter := counter +... PROESS clk,.,,.,,.,., PROESS,... : PROESS (clk) counter := counter +...

counter clk ( ), «ignored unnecessary pin clk».,,.,. PROESS (clk) IF(clk'EVENT AND clk='') THEN x <= d ---------------------- PROESS (clk) IF(clk'EVENT AND clk='') THEN y <= d VARIALE SIGNAL -7. VARIALE. SIGNAL. : --Solution : With a VARIALE ENTITY counter IS PORT ( clk, rst: IN IT count: OUT INTEGER RANGE TO 7) END counter ARHITETURE counter OF counter IS PROESS (clk, rst) VARIALE temp: INTEGER RANGE TO 7 IF (rst='') THEN temp:= ELSIF (clk'event AND clk='') THEN temp := temp+ count <= temp END counter VARIALE. (clk). : -- Solution 2: With SIGNALS only ENTITY counter IS PORT ( clk, rst: IN IT count: UFFER INTEGER RANGE TO 7) END counter ARHITETURE counter OF counter IS PROESS (clk, rst) IF (rst='') THEN count <= ELSIF (clk'event AND clk='') THEN count <= count + END counter 2, SIGNALS.,, count UFFER, ( ). SIGNAL VARIALE. std_logic_64 STD_LOGI. flipflops ( 3bit count). 4bit 4bit..

IF lear = '' THEN value <= (OTHERS => '') -- 4-bit vector of, same as "" ELSIF (lock'event AND lock='') THEN IF ount = '' THEN value <= value + Q <= value END ehavioral - lear ount VHDL. USE IEEE.STD_LOGI_UNSIGNED.ALL STD_LOGI_VETOR. value. clear, value OTHERS =>., count, value. count Q Q<=value, PROESS. LIRARY IEEE USE IEEE.STD_LOGI_64.ALL USE IEEE.STD_LOGI_UNSIGNED.ALL -- need this to -- add STD_LOGI_VETORs ENTITY counter IS PORT ( lock: IN STD_LOGI lear: IN STD_LOGI ount: IN STD_LOGI Q : OUT STD_LOGI_VETOR(3 DOWNTO )) END counter ARHITETURE ehavioral OF counter IS SIGNAL value: STD_LOGI_VETOR(3 DOWNTO ) PROESS (lock, lear) -.. lear ount Down VHDL. LIRARY IEEE USE IEEE.STD_LOGI_64.ALL ENTITY udcounter IS PORT ( lock: IN STD_LOGI

lear: IN STD_LOGI ount: IN STD_LOGI Down: IN STD_LOGI Q: OUT INTEGER RANGE TO 5) END udcounter ARHITETURE ehavioral OF udcounter IS PROESS (lock, lear) VARIALE value: INTEGER RANGE TO 5 IF (lear = '') THEN value := ELSIF (lock'event AND lock='') THEN IF (ount = '') THEN IF (Down = '') THEN value := value + ELSE value := value - Q <= value END ehavioral 2 lear Load ount Down VHDL. - -...