增加data数据
This commit is contained in:
@@ -1 +1,6 @@
|
|||||||
01 02 03 04 05 06 07 08 09 10
|
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
|
@@ -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
|
|
@@ -30,8 +30,8 @@ module testbench();
|
|||||||
mem mem_mod(
|
mem mem_mod(
|
||||||
.clk(clk),
|
.clk(clk),
|
||||||
.rst(rst),
|
.rst(rst),
|
||||||
.write_en(1'b1),
|
.write_en(1'b0),
|
||||||
.read_en(1'b0),
|
.read_en(1'b1),
|
||||||
.data_in(data),
|
.data_in(data),
|
||||||
.addr(sum[7:0]),
|
.addr(sum[7:0]),
|
||||||
.data_out(read_data)
|
.data_out(read_data)
|
||||||
|
Reference in New Issue
Block a user