mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
feat(rom): support for reading sequentially
This helps in case where some of the `ui_in` pins can't be set due to a plugged-in Pmod or other conflicting driver.
This commit is contained in:
+14
-1
@@ -30,8 +30,21 @@ module tt_um_chip_rom (
|
||||
$readmemh(`ROM_VMEM_PATH, rom_data);
|
||||
end
|
||||
|
||||
assign uo_out = rom_data[ui_in];
|
||||
// The address counter, only used when rst_n is low
|
||||
reg [7:0] addr_counter;
|
||||
wire [7:0] selected_addr = rst_n ? ui_in : addr_counter;
|
||||
|
||||
assign uo_out = rom_data[selected_addr];
|
||||
assign uio_out = 8'h00;
|
||||
assign uio_oe = 8'h00;
|
||||
|
||||
|
||||
always @(posedge clk or posedge rst_n) begin
|
||||
if (rst_n) begin
|
||||
addr_counter <= 0;
|
||||
end else begin
|
||||
addr_counter <= addr_counter + 1;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule // tt_um_chip_rom
|
||||
|
||||
Reference in New Issue
Block a user