Verilog HDL Program for Random Number Generator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | module tff(q,t,c); output q; input t,c; reg q; initial begin q=1'b1; end always @ (posedge c) begin if (t==1'b0) begin q=q; end else begin q=~q; end end endmodule module tff1(q,t,c); output q; input t,c; reg q; initial begin q=1'b0; end always @ (posedge c) begin if (t==1'b0) begin q=q; end else begin q=~q; end end endmodule module random(o,clk); output [3:0]o; input clk; xor (t0,o[3],o[2]); assign t1=o[0]; assign t2=o[1]; assign t3=o[2]; tff u1(o[0],t0,clk); tff1 u2(o[1],t1,clk); tff1 u3(o[2],t2,clk); tff1 u4(o[3],t3,clk); endmodule |
Simulated waveform for Random Number Generator
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com