Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NanoXplore synthesis #4504

Merged
merged 80 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3b48e9d
Add initial NanoXplore pass
Ravenslofty Mar 1, 2024
94b6f19
Make lut init match vendor tools
mmicko Mar 1, 2024
93543bd
add lut tests
mmicko Mar 1, 2024
b4a17cc
add few more tests
mmicko Mar 1, 2024
b4e9bb0
Add FFs and related tests
Ravenslofty Mar 1, 2024
b3f59c9
Add NX_CY
Ravenslofty Mar 1, 2024
8374f03
add family and ability to disable carry chains
mmicko Mar 1, 2024
5d898ab
Add blackboxes
mmicko Mar 1, 2024
b0c4add
Added lutram
Ravenslofty Mar 1, 2024
65d2eba
fix test
mmicko Mar 1, 2024
4c1f84a
add io mapping
mmicko Mar 1, 2024
74289b7
remove init from sdff
mmicko Mar 1, 2024
989eef2
produce less cells
mmicko Mar 1, 2024
9700971
just copy LOC
mmicko Mar 6, 2024
cfce7dd
remove soc
mmicko Mar 11, 2024
827ea11
start splitting blackboxes and add wrapper techmap
mmicko Mar 11, 2024
815622f
CDC_L wrappers
mmicko Mar 11, 2024
60611b9
CDC_U
mmicko Mar 11, 2024
ce635ab
NX_DSP/SPLIT
mmicko Mar 11, 2024
200e1a7
more DSP wrappers
mmicko Mar 12, 2024
0ecc2e5
PLLs
mmicko Mar 12, 2024
3ed5ea2
sortout more blackboxes
mmicko Mar 12, 2024
012f0e2
memory blocks
mmicko Mar 13, 2024
8f42d6d
fifo
mmicko Mar 13, 2024
f836de6
mark DSPs as TODOs for now
mmicko Mar 13, 2024
ef15325
removed virtual primitive
mmicko Mar 13, 2024
71f0984
fixes
mmicko Mar 13, 2024
b202126
IOM
mmicko Mar 13, 2024
8023f92
RAM
mmicko Mar 13, 2024
fa14c60
commented remainder of primitives
mmicko Mar 13, 2024
370517b
IO
mmicko Mar 13, 2024
a5bfb23
start cleaning rams
mmicko Mar 13, 2024
474ed28
added no-rw-check, and new rfb models
mmicko Mar 14, 2024
da6a62f
Initial carry chain handling pass
mmicko Mar 18, 2024
ab32dde
optimized
mmicko Mar 19, 2024
b6f7383
break long chains
mmicko Mar 19, 2024
31f9435
set add_carry property and all inputs to 0
mmicko Mar 25, 2024
cf21b48
fix co on nx_cy
mmicko Apr 7, 2024
dac4f04
add latch mapping, and remove aldff for now
mmicko Apr 19, 2024
1591d25
Made NX_CY model more robust
mmicko Apr 22, 2024
4cb8e62
Properly map ff ram
mmicko Apr 24, 2024
606439b
do not leave NX_RAM empty to prevent removing it
mmicko Apr 24, 2024
94675a5
Fix dff simulation model
mmicko Apr 29, 2024
0c4bbf7
Fix existing DFF mapping and add new types
mmicko Apr 29, 2024
198fc96
Add new DFF types, and added "-nodffe" option
mmicko Apr 29, 2024
cb45f8b
Fixed of mapping and initialization
mmicko Apr 30, 2024
dc16bdd
DFF reset and context must be in sync
mmicko Apr 30, 2024
9a9190b
enable dff context initialization
mmicko Apr 30, 2024
645888c
cleanup
mmicko May 6, 2024
34f08bc
Enable nanoxplore tests
mmicko May 6, 2024
41ae513
support other I/O configurations
mmicko May 7, 2024
04d3672
No need for LOC
mmicko May 9, 2024
f9f68c3
Split sim models into multiple files and implement few
mmicko May 10, 2024
11449ec
Cleanup not connected ports
mmicko May 15, 2024
7e4aef0
Add register file mapping
mmicko May 16, 2024
9d6b474
Add RF initialization
mmicko May 17, 2024
829dd62
block ram mapping for standard modes
mmicko May 17, 2024
8eb099c
remove debug attribute
mmicko May 20, 2024
f4d8ea4
Start adding RFB simulation models
mmicko May 20, 2024
41a86fd
fix
mmicko May 21, 2024
4aaab8f
start adding wfg model
mmicko May 22, 2024
5766555
Support brams with initialization
mmicko May 28, 2024
8909a42
Better wire check
mmicko May 30, 2024
596506b
Add NX_XCDC_U to wrappers
mmicko May 30, 2024
40f0500
Fix CY chaining and CI injection
mmicko May 30, 2024
f8ae93c
run setundef for all x inputs
mmicko Jun 6, 2024
4372487
raw must be 16 bits for nx tools to work
mmicko Jun 7, 2024
7601dc7
Some memory types are only supported on NG-LARGE
mmicko Jun 11, 2024
eb30be6
Impulse does not support these types but NG-ULTRA architecture does
mmicko Jun 24, 2024
6876a27
Add NX_DFR simulation model
mmicko Jul 4, 2024
1a6e5c6
Add meminit handling for NX_RFB_U
mmicko Jul 11, 2024
8f806c0
Added DDFR support
mmicko Jul 24, 2024
262ad03
Add iopads by default add option to disable and keep old one for comp…
mmicko Jul 24, 2024
3848563
Update tests
mmicko Jul 24, 2024
7bf623a
Fix simulation model warnings
mmicko Jul 24, 2024
dbf1d03
Cleanup
mmicko Jul 24, 2024
220ddea
Set -mince and -minsrst
mmicko Aug 14, 2024
14e4313
Run opt_merge, helps with inverted reset/load signals
mmicko Aug 14, 2024
54d237f
add min_ce_use and min_srst_use parameters
mmicko Aug 15, 2024
556c705
Cleanup of synth_nanoxplore pass
mmicko Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ endif
+cd tests/arch/anlogic && bash run-test.sh $(SEEDOPT)
+cd tests/arch/gowin && bash run-test.sh $(SEEDOPT)
+cd tests/arch/intel_alm && bash run-test.sh $(SEEDOPT)
+cd tests/arch/nanoxplore && bash run-test.sh $(SEEDOPT)
+cd tests/arch/nexus && bash run-test.sh $(SEEDOPT)
+cd tests/arch/quicklogic/pp3 && bash run-test.sh $(SEEDOPT)
+cd tests/arch/quicklogic/qlf_k6n10f && bash run-test.sh $(SEEDOPT)
Expand Down
31 changes: 31 additions & 0 deletions techlibs/nanoxplore/Makefile.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

OBJS += techlibs/nanoxplore/synth_nanoxplore.o
OBJS += techlibs/nanoxplore/nx_carry.o

# Techmap
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/arith_map.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/brams_init.vh))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/brams_map.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/brams.txt))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_bb.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_bb_l.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_bb_m.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_bb_u.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_map.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_sim.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_sim_l.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_sim_m.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_sim_u.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_wrap.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_wrap_l.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_wrap_m.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/cells_wrap_u.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/io_map.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/latches_map.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_init.vh))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_rams_l.txt))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_rams_m.txt))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_rams_u.txt))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_rams_map_l.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_rams_map_m.v))
$(eval $(call add_share_file,share/nanoxplore,techlibs/nanoxplore/rf_rams_map_u.v))
76 changes: 76 additions & 0 deletions techlibs/nanoxplore/arith_map.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2024 Miodrag Milanovic <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/

(* techmap_celltype = "$alu" *)
module _80_nx_cy_alu (A, B, CI, BI, X, Y, CO);
parameter A_SIGNED = 0;
parameter B_SIGNED = 0;
parameter A_WIDTH = 1;
parameter B_WIDTH = 1;
parameter Y_WIDTH = 1;

(* force_downto *)
input [A_WIDTH-1:0] A;
(* force_downto *)
input [B_WIDTH-1:0] B;
(* force_downto *)
output [Y_WIDTH-1:0] X, Y;

input CI, BI;
(* force_downto *)
output [Y_WIDTH-1:0] CO;
(* force_downto *)
wire [Y_WIDTH-1:0] COx;

wire _TECHMAP_FAIL_ = Y_WIDTH <= 2;

(* force_downto *)
wire [Y_WIDTH-1:0] A_buf, B_buf;
\$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(Y_WIDTH)) A_conv (.A(A), .Y(A_buf));
\$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(Y_WIDTH)) B_conv (.A(B), .Y(B_buf));

(* force_downto *)
wire [Y_WIDTH-1:0] AA = A_buf;
(* force_downto *)
wire [Y_WIDTH-1:0] BB = BI ? ~B_buf : B_buf;

genvar i;
generate for (i = 0; i < Y_WIDTH; i = i + 1) begin: slice
NX_CY_1BIT #(.first(i==0))
alu_i (
.CI(i==0 ? CI : COx[i-1]),
.A(AA[i]),
.B(BB[i]),
.S(Y[i]),
.CO(COx[i])
);

end: slice
endgenerate

NX_CY_1BIT alu_cout(
.CI(COx[Y_WIDTH-1]),
.A(1'b0),
.B(1'b0),
.S(CO[Y_WIDTH-1])
);

/* End implementation */
assign X = AA ^ BB;
endmodule
50 changes: 50 additions & 0 deletions techlibs/nanoxplore/brams.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ram block $__NX_RAM_ {
option "STD_MODE" "NOECC_48kx1" {
# only 32k used
abits 15;
widths 1 per_port;
}
option "STD_MODE" "NOECC_24kx2" {
# only 16k used
abits 14;
widths 2 per_port;
}
ifndef IS_NG_MEDIUM {
option "STD_MODE" "NOECC_16kx3" {
abits 14;
widths 3 per_port;
}
}
option "STD_MODE" "NOECC_12kx4" {
# only 8k used
abits 13;
widths 4 per_port;
}
ifndef IS_NG_MEDIUM {
option "STD_MODE" "NOECC_8kx6" {
abits 13;
widths 6 per_port;
}
}
option "STD_MODE" "NOECC_6kx8" {
# only 4k used
abits 12;
widths 8 per_port;
}
option "STD_MODE" "NOECC_4kx12" {
abits 12;
widths 12 per_port;
}
option "STD_MODE" "NOECC_2kx24" {
abits 11;
widths 24 per_port;
}
cost 64;
init no_undef;
port srsw "A" "B" {
clock anyedge;
clken;
rdwr no_change;
rdinit none;
}
}
23 changes: 23 additions & 0 deletions techlibs/nanoxplore/brams_init.vh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function [409600-1:0] bram_init_to_string;
input [49152-1:0] array;
input integer blocks;
input integer width;
reg [409600-1:0] temp; // (49152+2048)*8 48K bit data + 2k commas
reg [24-1:0] temp2;
integer i;
integer j;
begin
temp = "";
for (i = 0; i < 2048; i = i + 1) begin
if (i != 0) begin
temp = {temp, ","};
end
temp2 = 24'b0;
for (j = 0; j < blocks; j = j + 1) begin
temp2[j*width +: width] = array[{j, i[10:0]}*width +: width];
end
temp = {temp, $sformatf("%b",temp2[23:0])};
end
bram_init_to_string = temp;
end
endfunction
84 changes: 84 additions & 0 deletions techlibs/nanoxplore/brams_map.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module $__NX_RAM_ (...);

parameter INIT = 0;
parameter OPTION_STD_MODE = "NOECC_24kx2";

parameter PORT_A_WIDTH = 24;
parameter PORT_B_WIDTH = 24;

parameter PORT_A_CLK_POL = 1;

input PORT_A_CLK;
input PORT_A_CLK_EN;
input PORT_A_WR_EN;
input [15:0] PORT_A_ADDR;
input [PORT_A_WIDTH-1:0] PORT_A_WR_DATA;
wire [24-1:0] A_DATA;
output [PORT_A_WIDTH-1:0] PORT_A_RD_DATA;

parameter PORT_B_CLK_POL = 1;

input PORT_B_CLK;
input PORT_B_CLK_EN;
input PORT_B_WR_EN;
input [15:0] PORT_B_ADDR;
input [PORT_B_WIDTH-1:0] PORT_B_WR_DATA;
wire [24-1:0] B_DATA;
output [PORT_B_WIDTH-1:0] PORT_B_RD_DATA;

`include "brams_init.vh"

localparam raw_config1_val = OPTION_STD_MODE == "NOECC_48kx1" ? 16'b0000000000000000:
OPTION_STD_MODE == "NOECC_24kx2" ? 16'b0000001001001001:
OPTION_STD_MODE == "NOECC_16kx3" ? 16'b0000110110110110:
OPTION_STD_MODE == "NOECC_12kx4" ? 16'b0000010010010010:
OPTION_STD_MODE == "NOECC_8kx6" ? 16'b0000111111111111:
OPTION_STD_MODE == "NOECC_6kx8" ? 16'b0000011011011011:
OPTION_STD_MODE == "NOECC_4kx12" ? 16'b0000100100100100:
OPTION_STD_MODE == "NOECC_2kx24" ? 16'b0000101101101101:
16'bx;

localparam A_REPEAT = 24 / PORT_A_WIDTH;
localparam B_REPEAT = 24 / PORT_B_WIDTH;

assign A_DATA = {A_REPEAT{PORT_A_WR_DATA[PORT_A_WIDTH-1:0]}};
assign B_DATA = {B_REPEAT{PORT_B_WR_DATA[PORT_B_WIDTH-1:0]}};

NX_RAM_WRAP #(
.std_mode(OPTION_STD_MODE),
.mcka_edge(PORT_A_CLK_POL == 1 ? 1'b0 : 1'b1),
.mckb_edge(PORT_B_CLK_POL == 1 ? 1'b0 : 1'b1),
.pcka_edge(PORT_A_CLK_POL == 1 ? 1'b0 : 1'b1),
.pckb_edge(PORT_B_CLK_POL == 1 ? 1'b0 : 1'b1),
.raw_config0(4'b0000),
.raw_config1(raw_config1_val[15:0]),
.mem_ctxt($sformatf("%s",bram_init_to_string(INIT,A_REPEAT,PORT_A_WIDTH))),
) _TECHMAP_REPLACE_ (
.ACK(PORT_A_CLK),
//.ACKS(PORT_A_CLK),
//.ACKD(), // Not used in Non-ECC modes
//.ACKR(),
//.AR(),
//.ACOR(),
//.AERR(),
.ACS(PORT_A_CLK_EN),
.AWE(PORT_A_WR_EN),

.AA(PORT_A_ADDR),
.AI(A_DATA),
.AO(PORT_A_RD_DATA),

.BCK(PORT_B_CLK),
//.BCKC(PORT_B_CLK),
//.BCKD(), // Not used in Non-ECC modes
//.BCKR()
//.BR(),
//.BCOR(),
//.BERR(),
.BCS(PORT_B_CLK_EN),
.BWE(PORT_B_WR_EN),
.BA(PORT_B_ADDR),
.BI(B_DATA),
.BO(PORT_B_RD_DATA)
);
endmodule
Loading
Loading