summaryrefslogtreecommitdiffstats
path: root/fpga/gpmc/xilinx/common/logic_analyzer_data_storage.v
blob: c5cae3cc121644baf5d3c30ce960c6fd64ec4f97 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
//
// (c) 2014 Timothy Pearson, Raptor Engineering
// Released into the Public Domain
//
//////////////////////////////////////////////////////////////////////////////////

module logic_analyzer_data_storage(
	input clka,
	input clkb,
	input [63:0] dina,
	input [63:0] dinb,
	input [8:0] addra,
	input [8:0] addrb,
	input wea,
	input web,
	output reg [63:0] douta,
	output reg [63:0] doutb);

	parameter RAM_WIDTH = 64;
	
	// Xilinx specific directive
	(* RAM_STYLE="BLOCK" *)
	
	reg [RAM_WIDTH-1:0] data_storage_ram [(2**9)-1:0];
	
	always @(posedge clka) begin
		douta <= data_storage_ram[addra];
		if (wea) begin
			data_storage_ram[addra] <= dina;
			douta <= dina;
		end
	end

	always @(posedge clkb) begin
		doutb <= data_storage_ram[addrb];
		if (web) begin
			data_storage_ram[addrb] <= dinb;
			doutb <= dinb;
		end
	end

endmodule