From 8bc2134ec86699976ec7a168480ed334bcafbea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=B3=E5=85=89=E5=B0=91=E5=B9=B4?= <849317537@qq.com> Date: Tue, 4 Jun 2024 18:22:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ip_1_port_ram/ram.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ip_1_port_ram/ram.v b/ip_1_port_ram/ram.v index d8c7751..454c766 100644 --- a/ip_1_port_ram/ram.v +++ b/ip_1_port_ram/ram.v @@ -9,9 +9,7 @@ module ram( ); - - -(*mark_debug="true"*)reg [2:0]ram_addr; // 数据深度为8, 地址变化范围 0~7就行了 +(*mark_debug="true"*)reg [2:0]ram_addr; // 数据深度为8, 地址变化范围 0~7就行了, 每个时钟周期加1, 直到溢出从0开始 (*mark_debug="true"*)reg [2:0]in_ram_data; // 数据宽度为3, 假想写入的数据, 数据变化范围是0~7, 只有在 ram_rw 是写入的时候进行累加并写入地址内 (*mark_debug="true"*)wire [2:0]out_ram_data; @@ -27,8 +25,8 @@ always @(posedge sys_clk or negedge sys_rst) begin end -(*mark_debug="true"*)reg [7:0]counter; // 计数到15 清零, 变化范围 0~15 -wire ram_rw; +(*mark_debug="true"*)reg [7:0]counter; // 计数到15 清零, 变化范围 0~15, 0~7是写, 8~15是读 +wire ram_rw; // 是否可写/可读 (*mark_debug="true"*)assign ram_rw = ram_en && (counter <= 8'b111); // 计数器 分成读写各占一半时间 always @(posedge sys_clk or negedge sys_rst) begin if (!sys_rst) begin