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.

Need Code for 0 to 1 Transition

Status
Not open for further replies.

carrot

Full Member level 3
Joined
Feb 23, 2004
Messages
182
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Bangalore, India
Activity points
1,532
Hi ,

When input is transitioning from 0 to 1, output should be asserted for 1 cycle (in same cycle) with synchronous clock.
how will the verilog code look like?

Thanks,
Carrot
 

always@(posedge clk 0r negedge rst)
begin
if(~rst)
a_f <= 1'b0;
else
a_f <= input_a;
end

assign zero_to_one_transition = !a_f && input_a;

always@(posedge clk 0r negedge rst)
begin
if(~rst)
output_f <= 1'b0;
else if(zero_to_one_transition)
output_f <= 1'b1;
else
output_f <= 1'b0;
end

endmodule

Hope this helps
 
  • Like
Reactions: carrot

    carrot

    Points: 2
    Helpful Answer Positive Rating
can u clearly explain?? i cant understand your requirement??
 
  • Like
Reactions: carrot

    carrot

    Points: 2
    Helpful Answer Positive Rating
Something like this:


Code Verilog - [expand]
1
2
3
4
5
6
7
8
reg your_signal;
reg delayed_your_signal;
reg edge_detect;
 
always@(posedge clk) begin
    delayed_your_signal <= your_signal;
    edge_detect         <= your_signal & ~delayed_you_signal;
end



The "your_signal" can be a module input instead of a register, etc. But you get the idea.

- - - Updated - - -

Oh wait, I read it wrong. You say "in same cycle". Then you want a combinational circuit on the output. In which case sakthikumaran87 already gave you the answer. The "zero_to_one_transition" signal is what you want then. Anyways, if neither of the offered options is what you're looking for, please clarify the requirements.

- - - Updated - - -

Also see this thread on the same topic.
 
  • Like
Reactions: carrot

    carrot

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top