(原創) 如何將RTL產生netlist後讓其他人作synthesis? (SOC) (ISE)
Abstract
有時我們與其他人一起合作,又想保護自己的RTL code,但又希望別人可以作synthesis、simulation與implementation,此時我們希望只給對方synthesis後的netfile file,而不要給對方RTL code,我們該怎麼做呢?
Introduction
使用環境:Xilinx ISE 12.3
將自己的RTL合成出netlist file
假設以下是我們想合成的RTL code
counter.v / Verilog
1
/*
2
(C) OOMusou 2011
http://oomusou.cnblogs.com
3
4
Filename : counter.v
5
Synthesizer : Xilinx ISE 12.3
6
Description : generate netlist file (*.ngc)
7
Release : 02/12/2011 1.0
8
*/
9
10
module
counter (
11
clk,
12
rst_n,
13
cnt_o
14
);
15
16
input
clk;
17
input
rst_n;
18
output
[
1
:
0
] cnt_o;
19
20
reg
[
1
:
0
] cnt_o;
21
22
always
@(
posedge
clk
or
negedge
rst_n)
23
if
(
~
rst_n)
24
cnt_o
<=
2
'
h0;
25
else
26
cnt_o
<=
cnt_o
+
1
'
b1;
27
28
endmodule
Step 1:
New Project
指定project名稱與路徑
Step 2:
設定FPGA型號,並使用Xilinx XST作為synthesizer
Step 3:
Project Summary
Step 4:
Add Source
Step 5:
更改XST設定
選擇Category選項,並將Property display level選擇Advanced;
1.不要選擇Add I/O Buffers:一般來說,XST會為Top Module加上I/O Buffer,但因為目前我們的RTL算是IP,只是其中的一小部份,所以不需加上I/O Buffer。
2.設定Number of Clock Buffers為0:一般來說,XST會為clk信號與很多fanout的信號加上Clock Buffer,由於我們只是IP,算是其中的一小部份,所以不用加上Clock Buffers。
Step 6:
使用Xilinx XST進行Synthesize,產生netlist file:counter.ngc
將netlist file讓其他人作Synthesis
Step 1:
將counter.ngc與counter.v複製到對方project的目錄下
由於我們netlist只是其中一小部份,只要將counter.ngc給對方,並將counter.v的外殼給對方就好,內部的code不需給,如此就可以保護我們的RTL code。
counter.v / Verilog
1
/*
2
(C) OOMusou 2011
http://oomusou.cnblogs.com
3
4
Filename : counter.v
5
Synthesizer : Xilinx ISE 12.3
6
Description : generate netlist file (*.ngc)
7
Release : 02/12/2011 1.0
8
*/
9
10
module
counter (
11
clk,
12
rst_n,
13
cnt_o
14
);
15
16
input
clk;
17
input
rst_n;
18
output
[
1
:
0
] cnt_o;
19
20
21
endmodule
Step 2:
對方的Top Module
counter_top.v / Verilog
1
/*
2
(C) OOMusou 2011
http://oomusou.cnblogs.com
3
4
Filename : counter_top.v
5
Synthesizer : Xilinx ISE 12.3
6
Description : top module for counter_top
7
Release : 02/12/2011 1.0
8
*/
9
10
module
counter_top (
11
clk,
12
rst_n,
13
cnt_o
14
);
15
16
input
clk;
17
input
rst_n;
18
output
[
1
:
0
] cnt_o;
19
20
counter u_counter (
21
.clk(clk),
22
.rst_n(rst_n),
23
.cnt_o(cnt_o)
24
);
25
26
endmodule
這是對方的top module,實務上當然不會這麼簡單,還不過由於我們只是IP,只是其中的一部份而已,所以在top module中使用我們的IP。
Step 3:
進行Synthesis與Implementation
或許你會問,我們給了一個沒有body的counter.v與counter.ngc,真的對方可以合成嗎?事實上,XST會為每一個.v檔synthesize相對應的netlist (*.ngc),當synthesize到counter.v時,發現已經存在counter.ngc,就是把它當成block box使用,以下是ISE所產生的warning:
WARNING:Xst:
2211
-
"
counter.v
"
line
20
: Instantiating black box module <counter>.
完整程式碼下載
counter.7z (自己IP的project)
counter_top.7z (對方的project)
Conclusion
一般人應該不會有這種需求,我是因為在工作上跟其他公司合作,當初簽約時我們只答應提供netlist給對方作simulation與verification,並不提供RTL,所以才會找出這種方式,因為頗為特殊,特別做下紀錄。
全文完。
保护RTL代码的方法
本文介绍了一种在与其他团队合作时保护RTL代码的方法,通过仅提供综合后的netlist文件而非原始RTL代码来确保代码的安全性。



2243







评论
#1楼 2011-02-14 17:59Sivar
2、将modelsim编译后的目录和数据(.dat,.asm,.vhd等)做一个库给对方;
作simulation和verification的话,不知道这2种是否可行?加密之后合成(综合)工具还能合成(综合)么?
#2楼[楼主] 2011-02-15 00:43真 OO无双
謝謝你的建議,我來實驗一下再跟大家報告
#3楼22915062012/1/11 13:10:55 2012-01-11 13:10sheldon_lk