Advertisement
Guest User

Untitled

a guest
Aug 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Do not change Module name
  3. */
  4. module main;
  5.  
  6. initial begin
  7.     sr <= 20'h00001;
  8.     count <= 16'h0;
  9.     #20 $finish;
  10. end
  11.  
  12. // x19+x18+x16+x13+x12+x10+x9+x6+x5+x4+x2+1 (D3675 hex)
  13. // x19+x16+x11+x10+x5+x3+x2+1 (90C2D hex)
  14.    
  15. reg [19:0] sr;
  16.  
  17. wire shift_in = sr[19] ^ sr[18] ^ sr[16] ^ sr[13] ^ sr[12] ^ sr[10] ^                 sr[9] ^ sr[6] ^ sr[5] ^ sr[4] ^ sr[2] ^ sr[0];
  18.    
  19. //reg clock;
  20.  
  21. reg [7:0] count;
  22.  
  23.  
  24. always #1 begin
  25. //    clock = ~clock;
  26.     count <= count + 1;
  27.     $display("%d: The value in the LFSR is: %h", count, sr);
  28.     sr <= {sr[18:0], shift_in};
  29. end
  30.  
  31.    
  32. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement