2
0

fast_mem.sv 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // Fast local memory for the internal CPU.
  3. // This should be parameterized (again)...
  4. //
  5. module fast_mem
  6. #(
  7. parameter integer words_lg2,
  8. parameter data_file
  9. )
  10. (
  11. input rst_n,
  12. input clk,
  13. input write0,
  14. input read0,
  15. input [3:0] wstrb0,
  16. input [words_lg2-1:0] addr0,
  17. input [31:0] wdata0,
  18. output [31:0] rdata0,
  19. input write1,
  20. input read1,
  21. input [3:0] wstrb1,
  22. input [words_lg2-1:0] addr1,
  23. input [31:0] wdata1,
  24. output [31:0] rdata1
  25. );
  26. altsyncram ip (
  27. .aclr0 ( 1'b0 ),
  28. .clock0 ( clk ),
  29. .address_a ( addr0 ),
  30. .byteena_a ( wstrb0 ),
  31. .data_a ( wdata0 ),
  32. .rden_a ( read0 ),
  33. .wren_a ( write0 ),
  34. .q_a ( rdata0 ),
  35. .address_b ( addr1 ),
  36. .byteena_b ( wstrb1 ),
  37. .data_b ( wdata1 ),
  38. .rden_b ( read1 ),
  39. .wren_b ( write1 ),
  40. .q_b ( rdata1 ),
  41. // Unused signals
  42. .aclr1 (1'b0),
  43. .addressstall_a (1'b0),
  44. .addressstall_b (1'b0),
  45. .clock1 (1'b1),
  46. .clocken0 (1'b1),
  47. .clocken1 (1'b1),
  48. .clocken2 (1'b1),
  49. .clocken3 (1'b1),
  50. .eccstatus ());
  51. defparam
  52. ip.address_reg_b = "CLOCK0",
  53. ip.byteena_reg_b = "CLOCK0",
  54. ip.byte_size = 8,
  55. ip.clock_enable_input_a = "BYPASS",
  56. ip.clock_enable_input_b = "BYPASS",
  57. ip.clock_enable_output_a = "BYPASS",
  58. ip.clock_enable_output_b = "BYPASS",
  59. ip.indata_reg_b = "CLOCK0",
  60. ip.init_file = data_file,
  61. ip.intended_device_family = "Cyclone IV E",
  62. ip.lpm_type = "altsyncram",
  63. ip.numwords_a = 1 << words_lg2,
  64. ip.numwords_b = 1 << words_lg2,
  65. ip.operation_mode = "BIDIR_DUAL_PORT",
  66. ip.outdata_aclr_a = "CLEAR0",
  67. ip.outdata_aclr_b = "CLEAR0",
  68. ip.outdata_reg_a = "UNREGISTERED",
  69. ip.outdata_reg_b = "UNREGISTERED",
  70. ip.power_up_uninitialized = "FALSE",
  71. ip.read_during_write_mode_mixed_ports = "OLD_DATA",
  72. ip.read_during_write_mode_port_a = "OLD_DATA",
  73. ip.read_during_write_mode_port_b = "OLD_DATA",
  74. ip.widthad_a = words_lg2,
  75. ip.widthad_b = words_lg2,
  76. ip.width_a = 32,
  77. ip.width_b = 32,
  78. ip.width_byteena_a = 4,
  79. ip.width_byteena_b = 4,
  80. ip.wrcontrol_wraddress_reg_b = "CLOCK0";
  81. endmodule // fast_mem