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.

design problems in 74ls74 by verilog

Status
Not open for further replies.

MRFGUY

Full Member level 1
Joined
Sep 16, 2003
Messages
98
Helped
9
Reputation
18
Reaction score
3
Trophy points
1,288
Activity points
1,049
74ls74

Hi,

I just start to learn HDL and choose to study verilog. I try to write D-FF (74ls74), but it shows some errors. I've seen some D-FF example but those did not include preset and clear.

What wrong with my program? Please help me. Thanks alot.

Following is my program by using Xilinx

module dffpc(d, q, preset, clear, clk);
input d, preset, clear, clk;
output q;
reg q;

always @ (posedge clk or posedge clear or posedge preset)
begin
if (preset)
begin
if(clear)
q<=d;
else
q<=0;
end
else q<=1;
end

endmodule


ERRORS:

WARNING:Xst:1467 - dffpc.v line 11: Reset or set value is not constant in <q>. It could involve simulation mismatches
ERROR:Xst:899 - dffpc.v line 11: The logic for <q> does not match a known FF or Latch template.
 

xst:1467

You need to modify ur code as follows...
Both asyncronous set and reset are to be handled this way...
Here in this code preset has priority over reset...

Code:
module dffpc(d, q, preset, clear, clk);
   input d, preset, clear, clk;
   output      q;
   reg         q;
   
   always @ (posedge clk or posedge clear or posedge preset)
     begin
         if (preset)
           q <= 1;
         else if (clear)
           q <= 0;
         else
           q <= d;
     end
endmodule // dffpc

Hope this helps
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top