[go: up one dir, main page]

0% found this document useful (0 votes)
6 views21 pages

( - ELCT601 - ) 2 - Tutorial 7 (Tutorial Notes)

The document outlines the design and implementation of an n-bit binary divider using ASM (Algorithmic State Machine) charts and VHDL code. It details the steps involved in creating the ASM chart, data-path circuit, and control circuit, as well as the specific operations for registers involved in the division process. Additionally, it includes a sample VHDL code structure for the divider circuit, illustrating state transitions and output processes.

Uploaded by

ec441craft
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views21 pages

( - ELCT601 - ) 2 - Tutorial 7 (Tutorial Notes)

The document outlines the design and implementation of an n-bit binary divider using ASM (Algorithmic State Machine) charts and VHDL code. It details the steps involved in creating the ASM chart, data-path circuit, and control circuit, as well as the specific operations for registers involved in the division process. Additionally, it includes a sample VHDL code structure for the divider circuit, illustrating state transitions and output processes.

Uploaded by

ec441craft
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

By: Hoda Morshed 1

Prepared by: Hoda Morshed


➢ ASM chart elements
➢ Types of binary information
➢ Digital systems
➢ ASM design steps
➢ Sheet problem 1: n-bit Binary Divider

Prepared by: Hoda Morshed 2


▪ ASM more suitable for larger systems design than FSM.
▪ ASM consists of some steps to specify the solution of the problem.
▪ The verbal description is translate into ASM chart to specify the
sequence of operations and conditions of their execution.

➢Solve the sheet by hand!


➢Pay attention to lecture examples and understand them well!

Prepared by: Hoda Morshed 3


▪ State box

▪ Decision box

▪ Conditional box

Prepared by: Hoda Morshed 4


▪ Block: state box with its
corresponding decision and
conditional boxes

▪ Block specifies the operations


which will be performed during
one clock cycle

Prepared by: Hoda Morshed 5


Data info Control info
•Register operation or • Provides command signals to
output signals changes data section
•Controls sequence of operation

Prepared by: Hoda Morshed 6


Datapath circuit Control circuit
Performs data processing
Determines sequence of
inside the states and
the operation
conditional boxes

Uses elements as muxes,


Changes from one state to
adders, registers,
another
decoders and counters

Prepared by: Hoda Morshed 7


Prepared by: Hoda Morshed 8
➢The control circuit is sequential circuit whose internal states give
the control commands for the system

➢At any time, the control state starts a defined set of commands →
checks state conditions and external inputs → go to next state to
start another operation

Prepared by: Hoda Morshed 9


1. Get the ASM chart from verbal description or pseudo code
2. Specify the data information
3. Draw data path circuit
4. Get ASM chart for control signals
5. Draw control circuit
6. Write VHDL code for circuit from verbal description from step 1

Prepared by: Hoda Morshed 10


▪ Given two unsigned n-bit number A and B, design a circuit that produces two n-bit outputs Q
and R, where Q is the quotient A/B and R is the remainder. The procedure is illustrated and the
algorithm is described using pseudo-code. The notation R||A is used to represent a 2n-bit shift
register formed using R as the left-most n bits and A as the right-most n bits.

a) Find the ASM chart for the divider


b) Find the data-path circuit for the divider
c) Find the ASM chart for the divider control circuit

Prepared by: Hoda Morshed 11


Prepared by: Hoda Morshed 12
Prepared by: Hoda Morshed 16
▪ Reg Q: 1. Q=0 at reset / loaded with zeros
2. Q(0)=‘0’ / Q(0)=‘1’ shift new quotient bit
▪ Reg R: 1. R=0 at reset / loaded with zeros
2. SHL R||A shift left R
3. R=R – B load new remainder
▪ Reg C: 1. C=n – 1 load C with number of bits – 1
2. C=C – 1 count down to bit 0
▪ Reg A: 1. load A
2. SHL R||A shift left A
▪ Reg B: 1. load B
Prepared by: Hoda Morshed 18
Prepared by: Hoda Morshed 20
Prepared by: Hoda Morshed 21
Entity divider is
Port (clk, reset, s: in STD_LOGIC;
A, B: in STD_LOGIC_VECTOR(7 downto 0);
Q, R: out STD_LOGIC_VECTOR(7 downto 0));
end divider;
Architecture Behavioural of divider is
type state_type is (S0,S1,S2);
signal current_state: state_type;
signal A_reg, B_reg: STD_LOGIC_VECTOR(7 downto 0);
signal R_reg, Q_reg: STD_LOGIC_VECTOR(7 downto 0);
signal C: integer range 0 to 7;
Prepared by: Hoda Morshed 22
begin
Process(clk, reset) --State Transition Process
begin
if(reset = '1')then current_state <=S0;
elsif(clk='1' and clk'event)then
case(current_state)is
when S0 =>if(s = “1")then current_state <= S1;
else S<=S0; end if;
when S1 => current_state <= S2;
when S2 =>if(C = “0")then current_state <= S0;
else currnt_state <= S1; end if;
end case; end if; end process;
Prepared by: Hoda Morshed 23
Process(clk) --Output Process
begin

if(clk='1' and clk'event)then

case(current_state)is

when S0 => R_reg <= (other =>‘0’);

Q_reg <= (other =‘0’); C<= 7;

if(s = “0")then

A_reg <=A; B_reg <=B; end if;

when S1 => R_reg <=R_reg(6 downto 0)& A_reg(7);

Prepared by: Hoda Morshed A_reg <=A_reg(6 downto 0)&’0’; 24


when S2 => C <= C-1;

if(R_reg>= B_reg)then

Q_reg <= Q_reg(6 downto 0)&’1’;

R_reg <= R_reg - B_reg;

else Q_reg <= Q_reg(6 downto 0)&’0’;

end if;

end case; end if;

end process;

Q<= Q_reg; R<= R_reg;


Prepared by: Hoda Morshed
end Behavioural; 25
Prepared by: Hoda Morshed 26

You might also like