Professional Documents
Culture Documents
FPGA Based System Design: Engr. Rashid Farid Chishti Lecturer, Dee, Fet, Iiui Chishti@Iiu - Edu.Pk Week 8
FPGA Based System Design: Engr. Rashid Farid Chishti Lecturer, Dee, Fet, Iiui Chishti@Iiu - Edu.Pk Week 8
FPGA Based System Design: Engr. Rashid Farid Chishti Lecturer, Dee, Fet, Iiui Chishti@Iiu - Edu.Pk Week 8
www.iiu.edu.pk
www.iiu.edu.pk
A Mealy machine is a finite-state machine whose output values are determined both by its current state and the current inputs. (This is in contrast to a Moore machine, whose output values are determined solely by its current state.)
Mealy Machine
Structured Programming
// Structural description of sequential circuit module DFF (Q, D, CLK, RST); // D flip-flop with asynchronous reset. output Q; input D, CLK, RST; reg Q; always @(posedge CLK or negedge RST) if (~RST) Q = 1'b0; // Same as: if (RST == 0) else Q = D; endmodule module Mealy_Circuit (x , y, AB, CLK, RST); input x, CLK, RST; output y; output [1:0] AB; wire Da, Db,A,B; //Flip-flip input equations assign Da = (A&x) | (B&x) ; // assign Db = ~A & x ; // assign y = ~x & (A|B) ; // assign AB = {A , B} ; DFF Dffa (A, Da, CLK, RST); DFF Dffb (B, Db, CLK, RST); endmodule
www.iiu.edu.pk
Examples
module test_Mealy_Circuit; reg x, CLK, RST; wire Y; wire [1:0] ABC ; Mealy_Circuit MC1 (x ,Y , ABC, CLK, RST); initial begin CLK = 0; repeat (30) #5 CLK = ~CLK; end initial begin RST = 1; x = 0; #10 RST = 0; #10 RST = 1; repeat (6) #30 x = ~x; end endmodule
www.iiu.edu.pk
Input x 0 0 0 0 1 1 1 1
Next State A+ 0 0 0 0 0 1 1 1 B+ 0 0 0 0 1 1 0 0
Output y 0 1 1 1 0 0 0 0
State Table
Input
D 0 1
Next Output
Q(t+1) 0 1
0/0
00 input 1/0 output 01
0/1
0/1
1/0
1/0
11
Friday, May 17, 2013
www.iiu.edu.pk