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.

Please verify my simple Verilog program

Status
Not open for further replies.

ansree

Newbie level 1
Joined
Dec 15, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Dallas
Activity points
1,294
Verilog Program

Can you help me?

I’m currently looking at the following Verilog Example



An FPGA has the following four inputs: Reset, AClk, SigA, and BClk. It has one output, SigB.
Reset is a glitch-free, high-true asynchronous reset.
AClk and BClk come from two different oscillators.
The external circuit that drives SigA does so from an AND gate. The two inputs to that AND gate are driven by flip-flops clocked by AClk.
The sequence of events is as follows:
1) Reset asserts and deasserts asynchronously.
2) Several AClk and BClk cycles elapse.
3) SigA asserts for one AClk cycle and never asserts again.

Your FPGA must assert SigB for one BClk period in response to the asssertion of SigA.

Please provide Verilog code that implements the above design.



Here is what I’ve written:

module example(sigA,Aclk,Bclk,Reset,sigB);

inout sigA;

input wire Aclk;

input wire Bclk;

input wire Reset;

output sigB;

reg sigA;

reg sigB;

reg X;

reg Y;

//reg Z;

always @(posedge Reset)

if ((Aclk==1'b1) && (X==1'b1) && (Y==1'b1))

begin

sigA <= X & Y;

if (Bclk==1'b1)

sigB <=1'b1;

else

sigB <=1'b0;

end

else

sigA<=1'b0;

endmodule



I’ve used two signals called X and Y which are the inputs for the AND gate.

Please let me know incase I’ve made a mistake.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top