增加data数据

This commit is contained in:
ranchuan
2025-03-11 18:36:01 +08:00
parent 6efb3b0473
commit f52af2470e
3 changed files with 8 additions and 36 deletions

View File

@@ -1 +1,6 @@
01 02 03 04 05 06 07 08 09 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60

View File

@@ -1,33 +0,0 @@
module test (
input clk,
input rst,
input [7:0] data,
output dout,
output reg [7:0] data_addr,
// 声明变量 如果不指定变量类型 则默认是wire类型
output reg [31:0] sum
);
reg [31:0] count;
assign dout = ~clk;
// 在时钟的上升沿开始计算
// 对时钟上升沿或rst电平敏感
always @(posedge clk or rst) begin
if(rst==0) begin
sum <= 0;
count <= 0;
data_addr <=0;
end
else begin
count <= count+1;
sum <= data*2;
data_addr <= count[7:0];
end
end
endmodule

View File

@@ -30,8 +30,8 @@ module testbench();
mem mem_mod(
.clk(clk),
.rst(rst),
.write_en(1'b1),
.read_en(1'b0),
.write_en(1'b0),
.read_en(1'b1),
.data_in(data),
.addr(sum[7:0]),
.data_out(read_data)