Eee 270 Advanced Topics in Logic Design More On FSMDS: References/Credits
Eee 270 Advanced Topics in Logic Design More On FSMDS: References/Credits
More on FSMDs
References/credits:
Chapter 6 of: Pong P. Chu, FPGA Prototyping by VHDL
Examples: Xilinx Spartan-3 Version, Wiley 2008.
Chapter 5 from textbook.
Cris Ababei, Marquette University
Overview
entity period_counter is
port(
clk, reset: in std_logic;
start, si: in std_logic;
ready, done_tick: out std_logic;
prd: out std_logic_vector(9 downto 0)
);
end period_counter;
12345
Sketch of Datapath of Division circuit
library ieee;
use ieee.std_logic_1164.all; VHDL code
use ieee.numeric_std.all;
entity div is
generic(
W: integer:=8;
CBIT: integer:=4 -- CBIT=log2(W)+1
);
port(
clk, reset: in std_logic;
start: in std_logic;
dvsr, dvnd: in std_logic_vector(W-1 downto 0);
ready, done_tick: out std_logic;
quo, rmd: out std_logic_vector(W-1 downto 0)
);
end div;
-- output
quo <= rl_reg;
rmd <= std_logic_vector(rh_reg);
end arch;
Example 3: Binary-to-BCD converter
A decimal number is represented as a sequence of 4-bit
BCD digits
Example
Binary: 001000000000
BCD: 0101 0001 0010
Decimal: 5 1 2
VHDL description is left as an exercise
Example 3: Entity declaration
entity bin2bcd is
port(
clk: in std_logic;
reset: in std_logic;
start: in std_logic;
bin: in std_logic_vector(12 downto 0);
ready, done_tick: out std_logic;
bcd3,bcd2,bcd1,bcd0: out std_logic_vector(3 downto 0)
);
end bin2bcd ;
Example 4: Accurate low-frequency counter
Measure frequency of a periodic input waveform
One way:
Count number of input pulses in a fixed amount of time,
say 1 sec
Not working for low-frequency signals; example 2 Hz
Another way:
(1) Measure period of signal, (2) Take reciprocal
(f=1/T), (3) Convert binary number to BCD format
Assume: frequency of input signal is between 1-10 Hz (T =
100...1000 ms)
Structural description: Instantiate a period counter, a
division circuit, and a binary-3-BCD converter
Block diagram
ASM chart of main control
VHDL code
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity low_freq_counter is
port(
clk, reset: in std_logic;
start: in std_logic;
si: in std_logic;
bcd3, bcd2, bcd1, bcd0: out std_logic_vector(3 downto 0)
);
end low_freq_counter;
begin
--===============================================
-- component instantiation
--===============================================
end arch;
Example 5: Multiplier (revisited)
State graph and ASM chart of controller
Summary