Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pattern matching using state machine

Status
Not open for further replies.

dragonwarrior1

Newbie level 1
Joined
Feb 28, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
Hi,

Theres a state machine that makes output 1 if it finds the sequence "11001100" in the input, else makes output 0. If it finds the sequence "111001100" or "110011000" it does not find a match and will make output 0. How do I implement this in Verilog ?

Thanks in advance !
 

input in
reg [8:0] seq;
reg pass;

always @ (posedge clk or negedge rstn)
if (~rstn)
seq <= 'b0;
else
begin
seq <= {seq[7:0],in};
if (seq[7:0] == 11001100)
pass <= 1'b1;
end

// Add logic to deassert pass

Please post a better solution or point out if there are any corrections to this
 

first mistake is that if it is a sequence detector input must b of one bit only with one bit coming in on in every clock cycle.
u have to make a state machine first. i think it will have 12 stages hence 4 flip flops must be used to control state vectors. Make a state machine and do the verilog coding for the same.
 

The input here is a single bit 'in'
It is bit shifted into a register...any particular reason why a SM is required...
 

it will work fine in verilog but i think it will take more hardware, not a feasible design.
 

This design takes 9 flops+1 for pass and few gates, will a SM based design take less logic..?
It will need the same no of flops...

Will it be more readable..?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top