You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bram.sv 944 B

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date: 03/03/2021 12:49:56 PM
  7. // Design Name:
  8. // Module Name: bram
  9. // Project Name:
  10. // Target Devices:
  11. // Tool Versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module bram_v #(parameter ADDR_WIDTH=8, DATA_WIDTH=8, DEPTH=256)(
  22. input wire clk,ena,enb,wea,
  23. input wire [ADDR_WIDTH-1:0]addra, addrb,
  24. input wire [DATA_WIDTH-1:0]dia,
  25. output reg [DATA_WIDTH-1:0]dob
  26. );
  27. (*ram_style="block"*)reg [DATA_WIDTH-1:0]ram[0:DEPTH-1];
  28. always@(posedge clk)
  29. begin
  30. if (ena)
  31. begin
  32. if (wea)
  33. ram[addra] <=dia;
  34. end
  35. end
  36. always @(posedge clk)
  37. begin
  38. if (enb)
  39. dob <= ram[addrb];
  40. end
  41. endmodule