mirror of
https://gitlab.com/hyperglitch/jellyfish.git
synced 2025-12-22 06:15:25 +00:00
- testbenches updated with TB_DEPS directive for granular dependency definition - async_fifo added for transferring ADC data to QSPI - qspi reads fixed - adc_ctrl properly sampling the ADC - DAC tested and working - periodic ADC trigger added
40 lines
908 B
Systemverilog
40 lines
908 B
Systemverilog
// SPDX-FileCopyrightText: 2025 Igor Brkic <igor@hyperglitch.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
module SB_RAM40_4K #(
|
|
parameter WRITE_MODE = 1,
|
|
parameter READ_MODE = 0
|
|
)(
|
|
input wire [15:0] WDATA,
|
|
input wire [11:0] WADDR,
|
|
input wire WCLK,
|
|
input wire WCLKE,
|
|
input wire WE,
|
|
|
|
input wire [11:0] RADDR,
|
|
output reg [15:0] RDATA,
|
|
input wire RCLK,
|
|
input wire RCLKE,
|
|
input wire RE
|
|
);
|
|
|
|
// iCE40 BRAM has 4K bits; we're using 16-bit wide words = 256 entries
|
|
reg [15:0] mem [0:255];
|
|
|
|
// Write logic
|
|
always @(posedge WCLK) begin
|
|
if (WCLKE && WE) begin
|
|
mem[WADDR[7:0]] <= WDATA; // Only 256 words
|
|
end
|
|
end
|
|
|
|
// Read logic
|
|
always @(posedge RCLK) begin
|
|
if (RCLKE && RE) begin
|
|
RDATA <= mem[RADDR[7:0]];
|
|
end
|
|
end
|
|
|
|
endmodule
|
|
|