Tuesday, 31 March 2015

D FLIPFLOP



Behavioral :

module Dfp(d,clk,q,q1 );
input d,clk;
output reg q,q1;
always@(clk or d) begin
if (d<=1'b0) begin
q=1'b0;q1=1'b1;
end
else if (d<=1'b1) begin
q=1'b1;q1 =1'b0;
end
end
endmodule

Here i considered reset as q=0 (low)
                                        q1=1 (high)

&
Set  as q=1
          q1=0.

RTL schematic :

Test bench wave form :


<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-66283941-1', 'auto');
  ga('send', 'pageview');

</script>