哪位大神有verilog实现的双口RAM例程,就教!
时间:10-02
整理:3721RD
点击:
哪位大神有verilog实现的双口RAM例程,就教!
来源:
https://documentation.altera.com/#/00030683-AA$NT00064438
- module true_dual_port_ram_single_clock
- (
- input [(DATA_WIDTH-1):0] data_a, data_b,
- input [(ADDR_WIDTH-1):0] addr_a, addr_b,
- input we_a, we_b, clk,
- output reg [(DATA_WIDTH-1):0] q_a, q_b
- );
- parameter DATA_WIDTH = 8;
- parameter ADDR_WIDTH = 6;
- // Declare the RAM variable
- reg [DATA_WIDTH-1:0] ram[2**ADDR_WIDTH-1:0];
- always @ (posedge clk)
- begin // Port A
- if (we_a)
- begin
- ram[addr_a] <= data_a;
- q_a <= data_a;
- end
- else
- q_a <= ram[addr_a];
- end
- always @ (posedge clk)
- begin // Port b
- if (we_b)
- begin
- ram[addr_b] <= data_b;
- q_b <= data_b;
- end
- else
- q_b <= ram[addr_b];
- end
- endmodule
同我233333333333333333333333333333333333
工具上的模板,可以看看
这个页面从哪里找到的