URL
https://opencores.org/ocsvn/neopixel_fpga/neopixel_fpga/trunk
[/] [neopixel_fpga/] [trunk/] [rtl/] [ram_sync.v] - Blame information for rev 3
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
3 |
splinedriv |
/*
|
2 |
|
|
* FpgaNeoPixel - A spi to ws2812 machine
|
3 |
|
|
*
|
4 |
|
|
* Copyright (C) 2020 Hirosh Dabui <hirosh@dabui.de>
|
5 |
|
|
*
|
6 |
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
7 |
|
|
* purpose with or without fee is hereby granted, provided that the above
|
8 |
|
|
* copyright notice and this permission notice appear in all copies.
|
9 |
|
|
*
|
10 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
11 |
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
12 |
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
13 |
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
14 |
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
15 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
16 |
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
17 |
|
|
*
|
18 |
|
|
*/
|
19 |
|
|
module ram_sync(clk, addr, din, dout, we);
|
20 |
|
|
parameter ADDRESS_LINES = 1024;
|
21 |
|
|
parameter DATA_WIDTH = 24;
|
22 |
|
|
|
23 |
|
|
input clk;
|
24 |
|
|
input [$clog2(ADDRESS_LINES)-1:0] addr;
|
25 |
|
|
input [DATA_WIDTH-1:0] din;
|
26 |
|
|
output reg[DATA_WIDTH-1:0] dout;
|
27 |
|
|
|
28 |
|
|
input we;
|
29 |
|
|
|
30 |
|
|
reg [DATA_WIDTH-1:0] mem [(ADDRESS_LINES)-1:0];
|
31 |
|
|
|
32 |
|
|
always @(posedge clk) begin
|
33 |
|
|
if (we)
|
34 |
|
|
mem[addr] <= din;
|
35 |
|
|
|
36 |
|
|
dout <= mem[addr];
|
37 |
|
|
end
|
38 |
|
|
|
39 |
|
|
endmodule
|
40 |
|
|
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.