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.

posedge & negedge flipflops using mux....correct me if w

Status
Not open for further replies.

Guru59

Full Member level 4
Full Member level 4
Joined
Jul 10, 2006
Messages
217
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Activity points
2,812
Hi all,
Below is the verilog code for posedge and negedge flipflops using mux.
I have also attached the pictorial representation of the circuit.

Verilog code :
module mux_ff(
clk,
in,
out_pos,
out_neg
);

input clk;
input in;
output out_pos;
output out_neg;

wire clk;
wire in;
reg out_pos;
reg out_neg;

reg pos_reg,neg_reg;


always @ (clk or in)
begin
pos_reg = ~ clk ? in : pos_reg ;
out_pos = clk ? pos_reg : out_pos ;
end

always @ (clk or in)
begin
neg_reg = clk ? in : neg_reg ;
out_neg = ~ clk ? neg_reg : out_neg ;
end

endmodule



correct me if i am wrong.....thanks
 

Re: posedge & negedge flipflops using mux....correct me

That is not the correct way to code a negative or positive edge flip flop if that is what you are trying to do. To correctly synthesize a flip flop with verilog you need to use posedge/negedge keywords. Here is an example of how to code verilog flip flops.
**broken link removed**
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top