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_L.sv 1014 B

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date: 03/09/2021 12:54:48 AM
  7. // Design Name:
  8. // Module Name: bram_L
  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_L #(parameter BITS=8, ADDR_WIDTH=8, DATA_WIDTH=8, DEPTH=256, N=4)(
  22. input wire clk,ena,enb,wea,
  23. input wire [ADDR_WIDTH-1:0]addra, addrb,
  24. //input wire [N-1:0][7:0]dia,
  25. //output reg [N-1:0][7:0]dob
  26. input wire [(N*BITS-1):0]dia,
  27. output reg [(N*BITS-1):0]dob
  28. );
  29. (*ram_style="block"*)reg [DATA_WIDTH-1:0]ram[0:DEPTH-1];
  30. always@(posedge clk)
  31. begin
  32. if (ena)
  33. begin
  34. if (wea)
  35. ram[addra] <=dia;
  36. end
  37. end
  38. always @(posedge clk)
  39. begin
  40. if (enb)
  41. dob <= ram[addrb];
  42. end
  43. endmodule