File: memlib_wide_read.v

package info (click to toggle)
yosys 0.52-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 69,796 kB
  • sloc: ansic: 696,955; cpp: 239,736; python: 14,617; yacc: 3,529; sh: 2,175; makefile: 1,945; lex: 697; perl: 445; javascript: 323; tcl: 162; vhdl: 115
file content (25 lines) | stat: -rw-r--r-- 511 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module RAM_WIDE_READ #(
	parameter [63:0] INIT = 64'hx,
	parameter PORT_A_RD_WIDTH = 8,
	parameter PORT_A_WR_WIDTH = 2
) (
	input PORT_A_CLK,
	input PORT_A_RD_EN,
	input [5:0] PORT_A_ADDR,
	output reg [7:0] PORT_A_RD_DATA,
	input PORT_A_WR_EN,
	input [1:0] PORT_A_WR_DATA
);

reg [63:0] mem;

initial mem = INIT;

always @(posedge PORT_A_CLK) begin
	if (PORT_A_RD_EN)
		PORT_A_RD_DATA <= mem[{PORT_A_ADDR[5:3], 3'b000}+:8];
	if (PORT_A_WR_EN)
		mem[{PORT_A_ADDR[5:1],1'b0}+:2] <= PORT_A_WR_DATA;
end

endmodule