VERILOG RTL code help

Status
Not open for further replies.

tarek1984

Junior Member level 1
Joined
Jan 3, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
cairo
Activity points
1,406
Hi
i want to make this
pi = pi ⊕ pi−1

so i tried to use a d-flip flop to store the pi−1 to xor it with the new pi

and i used this verilog code for it

but for some reasons this do not work well

in the beginning i give a clear pulse to the d-ff then i need it give a delayed value of the previous output .
Can any body help me by this verilog code

thanks
 

Attachments

  • xor.jpg
    7 KB · Views: 83
Last edited:

You have coded a synchronous reset for the DFF, is that what you intend?
but for some reasons this do not work well
Can you be more specific?

P.S.: I didn't see, that the always block misses an edge sensitive condition. It can't work.
A standard DFF with positive clock edge and low active clear looks like this:
Code:
always @ (posedge C or negedge CLR)
if (~CLR) begin
Q <= 1'b0;
end else begin
Q <= D;
end
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…