Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. module sparseMemory();
  2.  
  3. typedef enum {false, true} boolean;
  4. bit[31:0] highestIndex;
  5. bit[31:0] lowestIndex;
  6. boolean bigMemory[bit[31:0]];
  7.  
  8. initial begin
  9. for(int i = 0; i < 25; i++) begin
  10. bigMemory[$urandom] = true;
  11. end
  12.  
  13. bigMemory.first(lowestIndex);
  14. bigMemory.last(highestIndex);
  15.  
  16. $display("bigMemory has %0d inputs", bigMemory.size());
  17. $display("The lowest index is %0d", lowestIndex);
  18. $display("The highest index is %0d", highestIndex);
  19. $display("Here are the addresses");
  20. foreach(bigMemory[i])
  21. $display(i);
  22. end
  23.  
  24. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement