temperature_ram.v 507 B

123456789101112131415161718
  1. `timescale 1ns/1ps
  2. module temperature_ram #(
  3. parameter integer DEPTH = 27
  4. ) (
  5. input wire clk,
  6. input wire wr_en,
  7. input wire [4:0] wr_addr,
  8. input wire [7:0] wr_data,
  9. input wire [4:0] rd_addr,
  10. output wire [7:0] rd_data
  11. );
  12. (* ram_style = "block" *) reg [7:0] memory [0:DEPTH-1];
  13. always @(posedge clk) begin
  14. if (wr_en && wr_addr < DEPTH) memory[wr_addr] <= wr_data;
  15. end
  16. assign rd_data = (rd_addr < DEPTH) ? memory[rd_addr] : 8'hFF;
  17. endmodule