Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.

Slides:



Advertisements
Similar presentations
History TTL-logic PAL (Programmable Array Logic)
Advertisements

Arbitrary Waveform Discussion 5.5 Example 34.
Edge-Triggered D Flip-Flops Discussion D4.2 Example 26.
7-Segment Display: Spartan-3 board
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Adder Discussion D6.2 Example 17. s i = c i ^ (a i ^ b i ) c i+1 = a i * b i + c i * (a i ^ b i ) Full Adder (Appendix I)
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
Sequential-Circuit Building Blocks
Logic Design Fundamentals - 3 Discussion D3.2. Logic Design Fundamentals - 3 Basic Gates Basic Combinational Circuits Basic Sequential Circuits.
Registers VHDL Tutorial R. E. Haskell and D. M. Hanna T2: Sequential Logic Circuits.
RS-232 Port Discussion D7.1. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
Integer Square Root.
Simple Sequential Circuits in VHDL. Contents Sequential circuit examples: - SR latch in dataflow style - D flip-flop in behavioral style - shift register.
Single-Cycle Instructions VHDL Tutorial R. E. Haskell and D. M. Hanna T5: VHDL ROM.
FPGAs and VHDL Lecture L12.1. FPGAs and VHDL Field Programmable Gate Arrays (FPGAs) VHDL –2 x 1 MUX –4 x 1 MUX –An Adder –Binary-to-BCD Converter –A Register.
Finite State Machines Discussion D7.1 Mealy and Moore Machines.
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
7-Segment Display DIO1 Board. Digilab2 – DIO1 Boards Four 7-segment displays A0A1A2A3.
Lecture L6.2 VHDL Multiply Operator (*)
Lab 2 4-Bit Adder Digilent Spartan 3 Board Lecture L2.3.
Division Lecture L6.3. Division
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Digilab 7-Segment Displays Lab 4. selyInstruction name “000”true if b = a false otherwise = “001”true if b /= a false otherwise “010”true if b < a.
Finite State Machines Discussion D8.1 Example 36.
7-Segment Displays Digilent Spartan 3 Board Discussion DS-4.2.
VGA Port Discussion D9.1. Raster Scan Displays Electron beam CRT.
Division Discussion D11.3. Division
Sequential Multiplication Lecture L6.4. Multiplication 13 x = 8Fh 1101 x
Shift Registers Discussion D5.2 Example Bit Shift Register qs(3) qs(2) qs(1) qs(0) if rising_edge(CLK) then for i in 0 to 2 loop s(i) := s(i+1);
PS/2 Mouse/Keyboard Port Discussion D7.2. PS/2 Port.
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Designing with FPGAs ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
1 Sequential Logic Lecture #7. 모바일컴퓨팅특강 2 강의순서 Latch FlipFlop Shift Register Counter.
Main Project : Simple Processor Mini-Project : 3-bit binary counter (using 7400 series) Memory By Oluwayomi B. Adamo.
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Controllers ENGIN 341 – Advanced Digital Design University of Massachusetts Boston Department of Engineering Dr. Filip Cuckov.
Sequential Logic Design by VHDL
CDA 4253 FPGA System Design Sequential Circuit Building Blocks Hao Zheng Dept of Comp Sci & Eng USF.
INF H131 Clock and Reset Unit (CRU) module library ieee; use ieee.std_logic_1164.all; entity cru is port ( arst : in std_logic; -- Asynch. reset.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Prime Numbers Lecture L6.1 Sieve of Eratosthenes.
Data Flow and Behavioral Modeling in VHDL 1 MS EMBEDDED SYSTEMS.
Registers and Counters Discussion D8.1. Logic Design Fundamentals - 3 Registers Counters Shift Registers.
Sequential statements (1) process
Lecture L5.1 Mealy and Moore Machines
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Dept. of Info. & Comm. Eng. Prof. Jongbok Lee
Sequential-Circuit Building Blocks
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
مدار های ترکیبی دیکدر لامپ های هفت قسمتی یکی از دیکدر هایی که اغلب به کار برده می شود،دیکدر 4 به 7 برای تبدیل کد bcd به کد هفت بیتی برای لامپ های seven.
A Greatest Common Divisor (GCD) Processor
Fibonacci Sequence Lecture L4.1 Lab 3.
Multiplication Discussion 11.1.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
Fast, Asynchronous SRAM
RS-232 Port Discussion D12.1.
VGA Port CSE 678.
Sequntial-Circuit Building Blocks
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
Presentation transcript:

Counters Discussion D5.3 Example 33

Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter

3-Bit, Divide-by-8 Counter

Divide-by-8 Counter s s s s s s s s State q2 q1 q0 D2 D1 D0 Present state Next state

Divide-by-8 Counter q2 q1 q D2 D2 = ~q2 & q1 & q0 | q2 & ~q1 | q2 & ~q0 s s s s s s s s State q2 q1 q0 D2 D1 D0 Present state Next state

Divide-by-8 Counter q2 q1 q D1 D1 = ~q1 & q0 | q1 & ~q0 s s s s s s s s State q2 q1 q0 D2 D1 D0 Present state Next state

Divide-by-8 Counter q2 q1 q D0 D0 = ~q0 s s s s s s s s State q2 q1 q0 D2 D1 D0 Present state Next state

Divide-by-8 Counter A Divide by 8 counter circuit using D Flip-flops

-- Example 33a: 3-bit divide-by-8 counter library IEEE; use IEEE.STD_LOGIC_1164.all; entity count3a is port( clr : in STD_LOGIC; clk : in STD_LOGIC; q : out STD_LOGIC_VECTOR(2 downto 0) ); end count3a;

architecture count3a of count3a is signal D, qs: STD_LOGIC_VECTOR(2 downto 0); begin D(2) <= (not qs(2) and qs(1) and qs(0)) or (qs(2) and not qs(1)) or (qs(2) and not qs(0)); D(1) <= (not qs(1) and qs(0)) or (qs(1) and not qs(0)); D(0) <= not qs(0); -- Three D flip-flops process(clk, clr) begin if clr = '1' then qs <= "000"; elsif clk'event and clk = '1' then qs <= D; end if; end process; q <= qs; end count3a;

count3a Simulation

Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in VHDL Modulo-5 Counter An N-Bit Counter

3-Bit Counter if clr = '1' then count <= "000"; elsif rising_edge(clk) then count <= count + 1; end if; Q <= count; Behavior signal count: STD_LOGIC_VECTOR (2 downto 0); count3 clr clk q(2 downto 0)

library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all; entity count3b is port( clk : in STD_LOGIC; clr : in STD_LOGIC; q : out STD_LOGIC_VECTOR(2 downto 0) ); end count3b; architecture count3b of count3b is signal count: STD_LOGIC_VECTOR(2 downto 0); begin process(clr,clk) begin if clr = '1' then count <= "000"; elsif clk'event and clk = '1' then count <= count + 1; end if; end process; q <= count; end count3b; count3.vhd Asynchronous clear Need signal because q can not be read Signal count increments on rising edge of clk

count3 Simulation

signal clk, cclk: std_logic; signal clkdiv: std_logic_vector(23 downto 0); begin -- Divide the master clock (50Mhz) down to a lower frequency. -- clock divider process(mclk, clr) begin if clr = '1' then clkdiv <= X"000000"; elsif mclk'event and mclk = '1' then clkdiv <= clkdiv + 1; end if; end process; clk <= clkdiv(0);-- mclk/2 = 25 MHz cclk <= clkdiv(17);-- mclk/2 18 = 190 Hz Clock Divider mclk = 50 MHz master clock (FPGA Pin T9)

Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter

-- Example 33c: modulo-5 counter library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all; entity mod5cnt is port( clr : in STD_LOGIC; clk : in STD_LOGIC; q : out STD_LOGIC_VECTOR(2 downto 0) ); end mod5cnt; architecture mod5cnt of mod5cnt is signal count: STD_LOGIC_VECTOR(2 downto 0); begin -- modul0-5 counter process(clk, clr) begin if clr = '1' then count <= "000"; elsif clk'event and clk = '1' then if count = "100" then count <= "000"; else count <= count + 1; end if; end process; q <= count; end mod5cnt;

mod5cnt Simulation

Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter

-- Example 33d: N-bit counter library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all; entity counter is generic(N : integer := 8); port( clr : in STD_LOGIC; clk : in STD_LOGIC; q : out STD_LOGIC_VECTOR(N-1 downto 0) ); end counter;

architecture counter of counter is signal count: STD_LOGIC_VECTOR(N-1 downto 0); begin -- N-bit counter process(clk, clr) begin if clr = '1' then count '0'); elsif clk'event and clk = '1' then count <= count + 1; end if; end process; q <= count; end counter; cnt16: counter generic map(N => 16) port map( clr => clr, clk => clk, q => q );

counter Simulation N = 8