maxxtorr723
Newbie level 5
- Joined
- Oct 19, 2013
- Messages
- 8
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 64
Hi, I am designing a jitter bounded DPLL in verilog for which I need a T flip-flop (for a down counter) which can toggle output on positive edge and load data asynchronously on negative edge. I wrote the code but it is not working as needed. Code is :-
The problem in this program is that even though the always@ block is activated at negative edge but since it checks if load=0 so say in case load is still at 0 and positive edge of clk arrives and the logic then checks to find that load=0 and again loads the data to q.
I am unable to figure out how to make this loading of data as edge triggered.
Please help!
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 module tff_async_load ( data , // Data Input clk , // Clock Input load , // Reset input q // Q output ); //-----------Input Ports--------------- input data, clk, load ; //-----------Output Ports--------------- output q; //------------Internal Variables-------- reg q; //-------------Code Starts Here--------- always @ ( posedge clk or negedge load) if (~load) begin q <= data; end else begin q <= !q; end endmodule //End Of Module tff_async_reset
The problem in this program is that even though the always@ block is activated at negative edge but since it checks if load=0 so say in case load is still at 0 and positive edge of clk arrives and the logic then checks to find that load=0 and again loads the data to q.
I am unable to figure out how to make this loading of data as edge triggered.
Please help!