aboutsummaryrefslogtreecommitdiffstats
path: root/tests/arch
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arch')
-rw-r--r--tests/arch/common/blockram.v31
-rw-r--r--tests/arch/ecp5/bug1836.mem32
-rw-r--r--tests/arch/ecp5/bug1836.ys23
-rw-r--r--tests/arch/ecp5/memories.ys10
-rw-r--r--tests/arch/gatemate/memory.ys8
-rw-r--r--tests/arch/ice40/spram.v22
-rw-r--r--tests/arch/ice40/spram.ys15
-rw-r--r--tests/arch/intel_alm/blockram.ys2
-rw-r--r--tests/arch/xilinx/asym_ram_sdp.ys50
-rw-r--r--tests/arch/xilinx/asym_ram_sdp_read_wider.v72
-rw-r--r--tests/arch/xilinx/asym_ram_sdp_write_wider.v71
-rw-r--r--tests/arch/xilinx/priority_memory.v122
-rw-r--r--tests/arch/xilinx/priority_memory.ys60
13 files changed, 516 insertions, 2 deletions
diff --git a/tests/arch/common/blockram.v b/tests/arch/common/blockram.v
index 5ed0736d0..c06ac96d5 100644
--- a/tests/arch/common/blockram.v
+++ b/tests/arch/common/blockram.v
@@ -22,7 +22,6 @@ module sync_ram_sp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
endmodule // sync_ram_sp
-`default_nettype none
module sync_ram_sdp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
(input wire clk, write_enable,
input wire [DATA_WIDTH-1:0] data_in,
@@ -45,3 +44,33 @@ module sync_ram_sdp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
endmodule // sync_ram_sdp
+
+module sync_ram_tdp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
+ (input wire clk_a, clk_b,
+ input wire write_enable_a, write_enable_b,
+ input wire read_enable_a, read_enable_b,
+ input wire [DATA_WIDTH-1:0] write_data_a, write_data_b,
+ input wire [ADDRESS_WIDTH-1:0] addr_a, addr_b,
+ output reg [DATA_WIDTH-1:0] read_data_a, read_data_b);
+
+ localparam WORD = (DATA_WIDTH-1);
+ localparam DEPTH = (2**ADDRESS_WIDTH-1);
+
+ reg [WORD:0] mem [0:DEPTH];
+
+ always @(posedge clk_a) begin
+ if (write_enable_a)
+ mem[addr_a] <= write_data_a;
+ else
+ read_data_a <= mem[addr_a];
+ end
+
+ always @(posedge clk_b) begin
+ if (write_enable_b)
+ mem[addr_b] <= write_data_b;
+ else
+ read_data_b <= mem[addr_b];
+ end
+
+endmodule // sync_ram_tdp
+
diff --git a/tests/arch/ecp5/bug1836.mem b/tests/arch/ecp5/bug1836.mem
new file mode 100644
index 000000000..1e904d87c
--- /dev/null
+++ b/tests/arch/ecp5/bug1836.mem
@@ -0,0 +1,32 @@
+0x8000,0x8324,0x8647,0x896a,0x8c8b,0x8fab,0x92c7,0x95e1,
+0x98f8,0x9c0b,0x9f19,0xa223,0xa527,0xa826,0xab1f,0xae10,
+0xb0fb,0xb3de,0xb6b9,0xb98c,0xbc56,0xbf17,0xc1cd,0xc47a,
+0xc71c,0xc9b3,0xcc3f,0xcebf,0xd133,0xd39a,0xd5f5,0xd842,
+0xda82,0xdcb3,0xded7,0xe0eb,0xe2f1,0xe4e8,0xe6cf,0xe8a6,
+0xea6d,0xec23,0xedc9,0xef5e,0xf0e2,0xf254,0xf3b5,0xf504,
+0xf641,0xf76b,0xf884,0xf989,0xfa7c,0xfb5c,0xfc29,0xfce3,
+0xfd89,0xfe1d,0xfe9c,0xff09,0xff61,0xffa6,0xffd8,0xfff5,
+0xffff,0xfff5,0xffd8,0xffa6,0xff61,0xff09,0xfe9c,0xfe1d,
+0xfd89,0xfce3,0xfc29,0xfb5c,0xfa7c,0xf989,0xf884,0xf76b,
+0xf641,0xf504,0xf3b5,0xf254,0xf0e2,0xef5e,0xedc9,0xec23,
+0xea6d,0xe8a6,0xe6cf,0xe4e8,0xe2f1,0xe0eb,0xded7,0xdcb3,
+0xda82,0xd842,0xd5f5,0xd39a,0xd133,0xcebf,0xcc3f,0xc9b3,
+0xc71c,0xc47a,0xc1cd,0xbf17,0xbc56,0xb98c,0xb6b9,0xb3de,
+0xb0fb,0xae10,0xab1f,0xa826,0xa527,0xa223,0x9f19,0x9c0b,
+0x98f8,0x95e1,0x92c7,0x8fab,0x8c8b,0x896a,0x8647,0x8324,
+0x8000,0x7cdb,0x79b8,0x7695,0x7374,0x7054,0x6d38,0x6a1e,
+0x6707,0x63f4,0x60e6,0x5ddc,0x5ad8,0x57d9,0x54e0,0x51ef,
+0x4f04,0x4c21,0x4946,0x4673,0x43a9,0x40e8,0x3e32,0x3b85,
+0x38e3,0x364c,0x33c0,0x3140,0x2ecc,0x2c65,0x2a0a,0x27bd,
+0x257d,0x234c,0x2128,0x1f14,0x1d0e,0x1b17,0x1930,0x1759,
+0x1592,0x13dc,0x1236,0x10a1,0xf1d,0xdab,0xc4a,0xafb,
+0x9be,0x894,0x77b,0x676,0x583,0x4a3,0x3d6,0x31c,
+0x276,0x1e2,0x163,0xf6,0x9e,0x59,0x27,0xa,
+0x0,0xa,0x27,0x59,0x9e,0xf6,0x163,0x1e2,
+0x276,0x31c,0x3d6,0x4a3,0x583,0x676,0x77b,0x894,
+0x9be,0xafb,0xc4a,0xdab,0xf1d,0x10a1,0x1236,0x13dc,
+0x1592,0x1759,0x1930,0x1b17,0x1d0e,0x1f14,0x2128,0x234c,
+0x257d,0x27bd,0x2a0a,0x2c65,0x2ecc,0x3140,0x33c0,0x364c,
+0x38e3,0x3b85,0x3e32,0x40e8,0x43a9,0x4673,0x4946,0x4c21,
+0x4f04,0x51ef,0x54e0,0x57d9,0x5ad8,0x5ddc,0x60e6,0x63f4,
+0x6707,0x6a1e,0x6d38,0x7054,0x7374,0x7695,0x79b8,0x7cdb, \ No newline at end of file
diff --git a/tests/arch/ecp5/bug1836.ys b/tests/arch/ecp5/bug1836.ys
new file mode 100644
index 000000000..15cdf4228
--- /dev/null
+++ b/tests/arch/ecp5/bug1836.ys
@@ -0,0 +1,23 @@
+read_verilog <<EOT
+module top(
+ input clk,
+ output reg [15:0] sig1, sig2
+);
+ reg [7:0] ptr1, ptr2;
+ reg [15:0] mem [0:255];
+
+ initial begin
+ $readmemh("bug1836.mem", mem);
+ end
+
+ always @(posedge clk) begin
+ sig1 <= mem[ptr1];
+ ptr1 <= ptr1 + 3;
+ sig2 <= mem[ptr2];
+ ptr2 <= ptr2 + 7;
+ end
+endmodule
+EOT
+
+synth_ecp5 -top top
+select -assert-count 1 t:DP16KD
diff --git a/tests/arch/ecp5/memories.ys b/tests/arch/ecp5/memories.ys
index 5cddcb952..f075182c8 100644
--- a/tests/arch/ecp5/memories.ys
+++ b/tests/arch/ecp5/memories.ys
@@ -260,3 +260,13 @@ setattr -set logic_block 1 m:memory
synth_ecp5 -top sync_rom; cd sync_rom
select -assert-count 0 t:DP16KD # requested LUTROM explicitly
select -assert-min 9 t:LUT4
+
+# ============================== TDP RAM ==============================
+# RAM bits <= 18K; Data width <= 18x2; Address width <= 9: -> DP16KD
+
+design -reset; read_verilog -defer ../common/blockram.v
+chparam -set ADDRESS_WIDTH 9 -set DATA_WIDTH 18 sync_ram_tdp
+hierarchy -top sync_ram_tdp
+synth_ecp5 -top sync_ram_tdp; cd sync_ram_tdp
+select -assert-count 1 t:DP16KD
+select -assert-none t:LUT4
diff --git a/tests/arch/gatemate/memory.ys b/tests/arch/gatemate/memory.ys
index e919920f8..c4bf11cd3 100644
--- a/tests/arch/gatemate/memory.ys
+++ b/tests/arch/gatemate/memory.ys
@@ -6,6 +6,14 @@ cd sync_ram_sdp
select -assert-count 1 t:CC_BUFG
select -assert-count 1 t:CC_BRAM_20K
+# 512 x 20 bit x 2 -> CC_BRAM_20K TDP RAM
+design -reset
+read_verilog ../common/blockram.v
+chparam -set ADDRESS_WIDTH 9 -set DATA_WIDTH 20 sync_ram_tdp
+synth_gatemate -top sync_ram_tdp -noiopad
+select -assert-count 2 t:CC_BUFG
+select -assert-count 1 t:CC_BRAM_20K
+
# 512 x 80 bit -> CC_BRAM_40K SDP RAM
design -reset
read_verilog ../common/blockram.v
diff --git a/tests/arch/ice40/spram.v b/tests/arch/ice40/spram.v
new file mode 100644
index 000000000..4e1aef2c6
--- /dev/null
+++ b/tests/arch/ice40/spram.v
@@ -0,0 +1,22 @@
+module top (clk, write_enable, read_enable, write_data, addr, read_data);
+parameter DATA_WIDTH = 8;
+parameter ADDR_WIDTH = 8;
+parameter SKIP_RDEN = 1;
+
+input clk;
+input write_enable, read_enable;
+input [DATA_WIDTH - 1 : 0] write_data;
+input [ADDR_WIDTH - 1 : 0] addr;
+output [DATA_WIDTH - 1 : 0] read_data;
+
+(* ram_style = "huge" *)
+reg [DATA_WIDTH - 1 : 0] mem [2**ADDR_WIDTH - 1 : 0];
+
+always @(posedge clk) begin
+ if (write_enable)
+ mem[addr] <= write_data;
+ else if (SKIP_RDEN || read_enable)
+ read_data <= mem[addr];
+end
+
+endmodule
diff --git a/tests/arch/ice40/spram.ys b/tests/arch/ice40/spram.ys
new file mode 100644
index 000000000..709c21862
--- /dev/null
+++ b/tests/arch/ice40/spram.ys
@@ -0,0 +1,15 @@
+read_verilog spram.v
+hierarchy -top top
+synth_ice40
+select -assert-count 1 t:SB_SPRAM256KA
+select -assert-none t:SB_SPRAM256KA %% t:* %D
+
+# Testing with pattern as described in pattern document
+design -reset
+read_verilog spram.v
+chparam -set SKIP_RDEN 0
+hierarchy -top top
+synth_ice40
+select -assert-count 1 t:SB_SPRAM256KA
+# Below fails due to extra SB_LUT4
+# select -assert-none t:SB_SPRAM256KA %% t:* %D
diff --git a/tests/arch/intel_alm/blockram.ys b/tests/arch/intel_alm/blockram.ys
index 3b61b9339..21b5ecbfb 100644
--- a/tests/arch/intel_alm/blockram.ys
+++ b/tests/arch/intel_alm/blockram.ys
@@ -1,6 +1,6 @@
read_verilog ../common/blockram.v
chparam -set ADDRESS_WIDTH 10 -set DATA_WIDTH 10 sync_ram_sdp
-synth_intel_alm -family cyclonev -noiopad -noclkbuf
+synth_intel_alm -top sync_ram_sdp -family cyclonev -noiopad -noclkbuf
cd sync_ram_sdp
select -assert-count 1 t:MISTRAL_NOT
select -assert-count 1 t:MISTRAL_M10K
diff --git a/tests/arch/xilinx/asym_ram_sdp.ys b/tests/arch/xilinx/asym_ram_sdp.ys
new file mode 100644
index 000000000..37f6f314d
--- /dev/null
+++ b/tests/arch/xilinx/asym_ram_sdp.ys
@@ -0,0 +1,50 @@
+# Memory bits <= 18K; Data width <= 36; Address width <= 14: -> RAMB18E1
+
+# w4b | r16b
+design -reset
+read_verilog asym_ram_sdp_read_wider.v
+synth_xilinx -top asym_ram_sdp_read_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
+# w8b | r16b
+design -reset
+read_verilog asym_ram_sdp_read_wider.v
+chparam -set WIDTHA 8 -set SIZEA 512 -set ADDRWIDTHA 9 asym_ram_sdp_read_wider
+synth_xilinx -top asym_ram_sdp_read_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
+# w4b | r32b
+design -reset
+read_verilog asym_ram_sdp_read_wider.v
+chparam -set WIDTHB 32 -set SIZEB 128 -set ADDRWIDTHB 7 asym_ram_sdp_read_wider
+synth_xilinx -top asym_ram_sdp_read_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
+# w16b | r4b
+design -reset
+read_verilog asym_ram_sdp_write_wider.v
+synth_xilinx -top asym_ram_sdp_write_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
+# w16b | r8b
+design -reset
+read_verilog asym_ram_sdp_write_wider.v
+chparam -set WIDTHB 8 -set SIZEB 512 -set ADDRWIDTHB 9 asym_ram_sdp_read_wider
+synth_xilinx -top asym_ram_sdp_write_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
+# w32b | r4b
+design -reset
+read_verilog asym_ram_sdp_write_wider.v
+chparam -set WIDTHA 32 -set SIZEA 128 -set ADDRWIDTHA 7 asym_ram_sdp_read_wider
+synth_xilinx -top asym_ram_sdp_write_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
+# w4b | r24b
+design -reset
+read_verilog asym_ram_sdp_read_wider.v
+chparam -set SIZEA 768
+chparam -set WIDTHB 24 -set SIZEB 128 -set ADDRWIDTHB 7 asym_ram_sdp_read_wider
+synth_xilinx -top asym_ram_sdp_read_wider -noiopad
+select -assert-count 1 t:RAMB18E1
+
diff --git a/tests/arch/xilinx/asym_ram_sdp_read_wider.v b/tests/arch/xilinx/asym_ram_sdp_read_wider.v
new file mode 100644
index 000000000..8743209e3
--- /dev/null
+++ b/tests/arch/xilinx/asym_ram_sdp_read_wider.v
@@ -0,0 +1,72 @@
+// Asymmetric port RAM
+// Read Wider than Write. Read Statement in loop
+//asym_ram_sdp_read_wider.v
+module asym_ram_sdp_read_wider (clkA, clkB, enaA, weA, enaB, addrA, addrB, diA, doB);
+ parameter WIDTHA = 4;
+ parameter SIZEA = 1024;
+ parameter ADDRWIDTHA = 10;
+
+ parameter WIDTHB = 16;
+ parameter SIZEB = 256;
+ parameter ADDRWIDTHB = 8;
+
+ input clkA;
+ input clkB;
+ input weA;
+ input enaA, enaB;
+ input [ADDRWIDTHA-1:0] addrA;
+ input [ADDRWIDTHB-1:0] addrB;
+ input [WIDTHA-1:0] diA;
+ output [WIDTHB-1:0] doB;
+
+ `define max(a,b) {(a) > (b) ? (a) : (b)}
+ `define min(a,b) {(a) < (b) ? (a) : (b)}
+
+ function integer log2;
+ input integer value;
+ reg [31:0] shifted;
+ integer res;
+ begin
+ if (value < 2)
+ log2 = value;
+ else
+ begin
+ shifted = value-1;
+ for (res=0; shifted>0; res=res+1)
+ shifted = shifted>>1;
+ log2 = res;
+ end
+ end
+ endfunction
+
+ localparam maxSIZE = `max(SIZEA, SIZEB);
+ localparam maxWIDTH = `max(WIDTHA, WIDTHB);
+ localparam minWIDTH = `min(WIDTHA, WIDTHB);
+
+ localparam RATIO = maxWIDTH / minWIDTH;
+ localparam log2RATIO = log2(RATIO);
+
+ reg [minWIDTH-1:0] RAM [0:maxSIZE-1];
+ reg [WIDTHB-1:0] readB;
+
+ always @(posedge clkA)
+ begin
+ if (enaA) begin
+ if (weA)
+ RAM[addrA] <= diA;
+ end
+ end
+
+ always @(posedge clkB)
+ begin : ramread
+ integer i;
+ reg [log2RATIO-1:0] lsbaddr;
+ if (enaB) begin
+ for (i = 0; i < RATIO; i = i+1) begin
+ lsbaddr = i;
+ readB[(i+1)*minWIDTH-1 -: minWIDTH] <= RAM[{addrB, lsbaddr}];
+ end
+ end
+ end
+ assign doB = readB;
+endmodule \ No newline at end of file
diff --git a/tests/arch/xilinx/asym_ram_sdp_write_wider.v b/tests/arch/xilinx/asym_ram_sdp_write_wider.v
new file mode 100644
index 000000000..cd61a3ccc
--- /dev/null
+++ b/tests/arch/xilinx/asym_ram_sdp_write_wider.v
@@ -0,0 +1,71 @@
+// Asymmetric port RAM
+// Write wider than Read. Write Statement in a loop.
+// asym_ram_sdp_write_wider.v
+module asym_ram_sdp_write_wider (clkA, clkB, weA, enaA, enaB, addrA, addrB, diA, doB);
+ parameter WIDTHB = 4;
+ parameter SIZEB = 1024;
+ parameter ADDRWIDTHB = 10;
+
+ parameter WIDTHA = 16;
+ parameter SIZEA = 256;
+ parameter ADDRWIDTHA = 8;
+
+ input clkA;
+ input clkB;
+ input weA;
+ input enaA, enaB;
+ input [ADDRWIDTHA-1:0] addrA;
+ input [ADDRWIDTHB-1:0] addrB;
+ input [WIDTHA-1:0] diA;
+ output [WIDTHB-1:0] doB;
+
+ `define max(a,b) {(a) > (b) ? (a) : (b)}
+ `define min(a,b) {(a) < (b) ? (a) : (b)}
+
+ function integer log2;
+ input integer value;
+ reg [31:0] shifted;
+ integer res;
+ begin
+ if (value < 2)
+ log2 = value;
+ else
+ begin
+ shifted = value-1;
+ for (res=0; shifted>0; res=res+1)
+ shifted = shifted>>1;
+ log2 = res;
+ end
+ end
+ endfunction
+
+ localparam maxSIZE = `max(SIZEA, SIZEB);
+ localparam maxWIDTH = `max(WIDTHA, WIDTHB);
+ localparam minWIDTH = `min(WIDTHA, WIDTHB);
+
+ localparam RATIO = maxWIDTH / minWIDTH;
+ localparam log2RATIO = log2(RATIO);
+
+ reg [minWIDTH-1:0] RAM [0:maxSIZE-1];
+ reg [WIDTHB-1:0] readB;
+
+ always @(posedge clkB) begin
+ if (enaB) begin
+ readB <= RAM[addrB];
+ end
+ end
+ assign doB = readB;
+
+ always @(posedge clkA)
+ begin : ramwrite
+ integer i;
+ reg [log2RATIO-1:0] lsbaddr;
+ for (i=0; i< RATIO; i= i+ 1) begin : write1
+ lsbaddr = i;
+ if (enaA) begin
+ if (weA)
+ RAM[{addrA, lsbaddr}] <= diA[(i+1)*minWIDTH-1 -: minWIDTH];
+ end
+ end
+ end
+endmodule \ No newline at end of file
diff --git a/tests/arch/xilinx/priority_memory.v b/tests/arch/xilinx/priority_memory.v
new file mode 100644
index 000000000..fc943e209
--- /dev/null
+++ b/tests/arch/xilinx/priority_memory.v
@@ -0,0 +1,122 @@
+module priority_memory (
+ clk, wren_a, rden_a, addr_a, wdata_a, rdata_a,
+ wren_b, rden_b, addr_b, wdata_b, rdata_b
+ );
+
+ parameter ABITS = 12;
+ parameter WIDTH = 72;
+
+ input clk;
+ input wren_a, rden_a, wren_b, rden_b;
+ input [ABITS-1:0] addr_a, addr_b;
+ input [WIDTH-1:0] wdata_a, wdata_b;
+ output reg [WIDTH-1:0] rdata_a, rdata_b;
+
+ `ifdef USE_HUGE
+ (* ram_style = "huge" *)
+ `endif
+ reg [WIDTH-1:0] mem [0:2**ABITS-1];
+
+ integer i;
+ initial begin
+ rdata_a <= 'h0;
+ rdata_b <= 'h0;
+ end
+
+ `ifndef FLIP_PORTS
+ always @(posedge clk) begin
+ // A port
+ if (wren_a)
+ mem[addr_a] <= wdata_a;
+ else if (rden_a)
+ rdata_a <= mem[addr_a];
+
+ // B port
+ if (wren_b)
+ mem[addr_b] <= wdata_b;
+ else if (rden_b)
+ if (wren_a && addr_a == addr_b)
+ rdata_b <= wdata_a;
+ else
+ rdata_b <= mem[addr_b];
+ end
+ `else // FLIP PORTS
+ always @(posedge clk) begin
+ // A port
+ if (wren_b)
+ mem[addr_b] <= wdata_b;
+ else if (rden_b)
+ rdata_b <= mem[addr_b];
+
+ // B port
+ if (wren_a)
+ mem[addr_a] <= wdata_a;
+ else if (rden_a)
+ if (wren_b && addr_a == addr_b)
+ rdata_a <= wdata_b;
+ else
+ rdata_a <= mem[addr_a];
+ end
+ `endif
+endmodule
+
+module sp_write_first (clk, wren_a, rden_a, addr_a, wdata_a, rdata_a);
+
+ parameter ABITS = 12;
+ parameter WIDTH = 72;
+
+ input clk;
+ input wren_a, rden_a;
+ input [ABITS-1:0] addr_a;
+ input [WIDTH-1:0] wdata_a;
+ output reg [WIDTH-1:0] rdata_a;
+
+ (* ram_style = "huge" *)
+ reg [WIDTH-1:0] mem [0:2**ABITS-1];
+
+ integer i;
+ initial begin
+ rdata_a <= 'h0;
+ end
+
+
+ always @(posedge clk) begin
+ // A port
+ if (wren_a)
+ mem[addr_a] <= wdata_a;
+ if (rden_a)
+ if (wren_a)
+ rdata_a <= wdata_a;
+ else
+ rdata_a <= mem[addr_a];
+ end
+endmodule
+
+module sp_read_first (clk, wren_a, rden_a, addr_a, wdata_a, rdata_a);
+
+ parameter ABITS = 12;
+ parameter WIDTH = 72;
+
+ input clk;
+ input wren_a, rden_a;
+ input [ABITS-1:0] addr_a;
+ input [WIDTH-1:0] wdata_a;
+ output reg [WIDTH-1:0] rdata_a;
+
+ (* ram_style = "huge" *)
+ reg [WIDTH-1:0] mem [0:2**ABITS-1];
+
+ integer i;
+ initial begin
+ rdata_a <= 'h0;
+ end
+
+
+ always @(posedge clk) begin
+ // A port
+ if (wren_a)
+ mem[addr_a] <= wdata_a;
+ if (rden_a)
+ rdata_a <= mem[addr_a];
+ end
+endmodule
diff --git a/tests/arch/xilinx/priority_memory.ys b/tests/arch/xilinx/priority_memory.ys
new file mode 100644
index 000000000..d0b2a16ad
--- /dev/null
+++ b/tests/arch/xilinx/priority_memory.ys
@@ -0,0 +1,60 @@
+
+# no uram by default
+design -reset
+read_verilog priority_memory.v
+synth_xilinx -family xcup -top priority_memory
+select -assert-none t:URAM288
+
+# uram parameter
+design -reset
+read -define USE_HUGE
+read_verilog priority_memory.v
+synth_xilinx -family xcup -top priority_memory -noiopad
+select -assert-count 1 t:URAM288
+
+# uram option
+design -reset
+read_verilog priority_memory.v
+synth_xilinx -family xcup -top priority_memory -noiopad -uram
+# check for URAM block
+select -assert-count 1 t:URAM288
+# check port A in code maps to port A in hardware:
+# %co:+[DOUT_A] selects everything connected to a URAM288.DOUT_A port
+# w:rdata_a selects the wire rdata_a
+# %i finds the intersection of the two above selections
+# if the result is 1 then the wire rdata_a is connected to Port A correctly
+select -assert-count 1 t:URAM288 %co:+[DOUT_A] w:rdata_a %i
+# we expect no more than 2 LUT2s to control the hardware priority
+# if there are extra LUTs, then it is likely emulating logic it shouldn't
+# ignore anything using blif, since that doesn't seem to support priority logic
+# and is indicative of using verific/tabby
+select -assert-max 2 t:LUT* n:*blif* %d
+
+# reverse priority
+design -reset
+read -define FLIP_PORTS
+read_verilog priority_memory.v
+synth_xilinx -family xcup -top priority_memory -noiopad -uram
+# test priority is mapped correctly, rdata_a should now be connected to Port B
+# see above for details
+select -assert-count 1 t:URAM288 %co:+[DOUT_B] w:rdata_a %i
+
+# sp write first
+design -reset
+read_verilog priority_memory.v
+synth_xilinx -family xcup -top sp_write_first -noiopad
+select -assert-count 1 t:URAM288
+# write first connects rdata_a to port B
+# similar to above, but also tests that rdata_a *isn't* connected to port A
+select -assert-none 1 t:URAM288 %co:+[DOUT_A] w:rdata_a %i
+select -assert-count 1 t:URAM288 %co:+[DOUT_B] w:rdata_a %i
+
+# sp read first
+design -reset
+read_verilog priority_memory.v
+synth_xilinx -family xcup -top sp_read_first -noiopad
+select -assert-count 1 t:URAM288
+# read first connects rdata_a to port A
+# see above for details
+select -assert-count 1 t:URAM288 %co:+[DOUT_A] w:rdata_a %i
+select -assert-none 1 t:URAM288 %co:+[DOUT_B] w:rdata_a %i