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.

synchronous reset (verilog)

Status
Not open for further replies.

pwq1999

Member level 2
Joined
Mar 2, 2008
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,578
verilog counter with synchronous reset

i write synchronous reset as follow:
always@(posedge sys_clk_25m)
begin
if(!syn_rst_n)
toggle_bit<=1'b0;
else
begin
if(!rtl8305_mtxen)
toggle_bit<=1'b0;
else
toggle_bit<=~toggle_bit;
end
end

but when i view the RTL Schematic, i found that the syn_rst_n signal make the logic or with the !rtl8305_mtxen signal ,which i don't expecte, so anyone can help me out how to express the synchronous reset without adding additional logic in reset input?
thanks in advance!
 

pwq1999 said:
/.../ found that the syn_rst_n signal make the logic or
with the !rtl8305_mtxen signal/...
this is what you wrote in the rtl;
can you describe the functionality you need ?
--
 

i want a multiplexer appear in front of the flip-flop, and the rtl8305_mtxen behaves as the select control signal. actually i don't want any logic appear in the reset input of the flip-flop, as i worry that it may make glitch in the reset input of flip-flop.
 

u can try your code like this

Code:
wire out;
always@(posedge sys_clk_25m)
begin
	if(!syn_rst_n)
		toggle_bit<=1'b0;
	else
	   toggle_bit<=out;
	/*if(!rtl8305_mtxen)
		toggle_bit<=1'b0;
	else
		toggle_bit<=~toggle_bit;*/
end 
assign out = rtl8305_mtxen?!toggle_bit:1'b0;

so that u will not get any logic in reset of your flip flop. since u used !syn_rst_n, so inverter will be inferred in synthesis tool..
 

pwq1999 said:
want a multiplexer appear in front of the flip-flop
in fact a mux is also a set of and/or gates, or - going down
to fpga architecture - it is composed of look-up tables as AND/OR gates are;
mux/or/and - it's just a graphical representation of the rtl;
i worry that it may make glitch in the reset input of flip-flop
you can have the same glitches if a mux is used;
but any glitches, if out of clock active slope, are not danger if they
appear at the input of a flip-flop;
--
 

thanks ,j_andr and research_vlsi, you two help me out! now i get the idea!
 

try this code
always@(posedge sys_clk_25m)
begin
if(!syn_rst_n) begin
toggle_bit<=1'b0;
end
else if(!rtl8305_mtxen) begin
toggle_bit<=1'b0;
end
else begin
toggle_bit<=~toggle_bit;
end
end
 

i can not see your code have difference with the code i posted above!
 

try this code

assign reset_n = syn_rst_n & rtl8305_mtxen ;

always@(posedge sys_clk_25m)
begin
if(!reset_n) begin
toggle_bit<=1'b0;
end
else
toggle_bit<=~toggle_bit;
end
 

try this code

Code:
assign temp = rtl8305_mtxen ? (~toggle_bit) : 1'b0;

always @(posedge sys_clk_25m)
begin
if(!syn_rst_n)
toggle_bit <= 1'b0;
else
begin
toggle_bit <= temp;
end
 

thanks you all, i have change the synchronous reset to asynchronous reset, and no logic appear in front of the reset of the flip-flop,but i believe that kib's code works well, and thanks you all again!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top