Advertisement
tekkundahsi

Untitled

May 7th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. module ram();
  2.  
  3. reg [6:0] adrs;
  4. reg [15:0] content;
  5. reg _ce, _we, _oe;
  6. wire [15:0] data;
  7. assign data = ~_ce & ~_we & _oe ? content : 8'hz;
  8. ram128x16 u1(adrs, data, _ce,_we,_oe);
  9. initial begin
  10. $monitor ("%4d: adrs = %h _ce + %b _we = %b _oe = %b data =%h", $time, adrs, _ce, _we, _oe, data);
  11.  
  12. adrs = 7'd0;
  13. content = 16'd0;
  14. _ce = 1'b0; _we = 1'b0; _oe = 1'b1;
  15. #100
  16. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  17. #500
  18. adrs = 7'b011111;
  19. content = 16'hFFFF;
  20. _ce = 1'b0; _we = 1'b0; _oe = 1'b1;
  21. #100
  22. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  23. #400
  24. adrs = 7'b100000;
  25. content = 16'd1514;
  26. _ce = 1'b0; _we = 1'b0; _oe = 1'b1;
  27. #100
  28. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  29. #400
  30. adrs = 7'b110000;
  31. content = 16'd1260;
  32. _ce = 1'b0; _we = 1'b0; _oe = 1'b1;
  33. #100
  34. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  35. #400
  36.  
  37. //read
  38.  
  39. adrs = 7'b000000;
  40. _ce = 1'b0; _we = 1'b1; _oe = 1'b0;
  41. #100
  42. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  43. #500
  44. adrs = 7'b011111;
  45. _ce = 1'b0; _we = 1'b1; _oe = 1'b0;
  46. #100
  47. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  48. #400
  49. adrs = 7'b100000;
  50. _ce = 1'b0; _we = 1'b1; _oe = 1'b0;
  51. #100
  52. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  53. #400
  54. adrs = 7'b110000;
  55. _ce = 1'b0; _we = 1'b1; _oe = 1'b0;
  56. #100
  57. _ce = 1'b1; _we = 1'b1; _oe = 1'b1;
  58. #400
  59.  
  60.  
  61. $finish;
  62.  
  63.  
  64.  
  65. end
  66.  
  67.  
  68. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement