mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-31 23:34:57 +00:00
Add tests for Xilinx UG901 examples
This commit is contained in:
parent
0d037bf9d8
commit
2ae7dec530
89 changed files with 2962 additions and 0 deletions
42
tests/xilinx_ug901/bytewrite_ram_1b.v
Normal file
42
tests/xilinx_ug901/bytewrite_ram_1b.v
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Single-Port BRAM with Byte-wide Write Enable
|
||||
// Read-First mode
|
||||
// Single-process description
|
||||
// Compact description of the write with a generate-for
|
||||
// statement
|
||||
// Column width and number of columns easily configurable
|
||||
//
|
||||
// bytewrite_ram_1b.v
|
||||
//
|
||||
|
||||
module bytewrite_ram_1b (clk, we, addr, di, do);
|
||||
|
||||
parameter SIZE = 1024;
|
||||
parameter ADDR_WIDTH = 10;
|
||||
parameter COL_WIDTH = 8;
|
||||
parameter NB_COL = 4;
|
||||
|
||||
input clk;
|
||||
input [NB_COL-1:0] we;
|
||||
input [ADDR_WIDTH-1:0] addr;
|
||||
input [NB_COL*COL_WIDTH-1:0] di;
|
||||
output reg [NB_COL*COL_WIDTH-1:0] do;
|
||||
|
||||
reg [NB_COL*COL_WIDTH-1:0] RAM [SIZE-1:0];
|
||||
|
||||
always @(posedge clk)
|
||||
begin
|
||||
do <= RAM[addr];
|
||||
end
|
||||
|
||||
generate genvar i;
|
||||
for (i = 0; i < NB_COL; i = i+1)
|
||||
begin
|
||||
always @(posedge clk)
|
||||
begin
|
||||
if (we[i])
|
||||
RAM[addr][(i+1)*COL_WIDTH-1:i*COL_WIDTH] <= di[(i+1)*COL_WIDTH-1:i*COL_WIDTH];
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue