【发布时间】:2019-08-16 04:10:33
【问题描述】:
我正在尝试使用 Yosys 命令 shell 获取 verilog 模块的默认参数值。 有什么办法吗? 此外,解析 `write_ilang' 命令输出文件是个好主意吗?或者它的格式在不久的将来会发生巨大变化?
尝试在 ilang、json、表转储甚至使用 chparam -list 命令中查找默认值,但没有带来任何结果。
考虑这个例子(文件 param_test.v):
module stub();
parameter PUBLIC_PARAM = 1;
parameter HIDDEN_PARAM = 2;
endmodule
module testbench();
stub no_param_stub ();
stub #(.PUBLIC_PARAM(1)) one_param_stub ();
endmodule
我遵循以下步骤:
- 加载源代码
read -sv param_test.v - 精心设计
hierarchy -top testbench - 尝试获取参数值。
write_ilang 命令的输出:
# Generated by Yosys 0.8+634 (git sha1 ac2fc3a, clang 3.8.0-2ubuntu4 -fPIC -Os)
autoidx 1
attribute \blackbox 1
attribute \src "param_test.v:1"
module $paramod\stub\PUBLIC_PARAM=1
parameter \HIDDEN_PARAM
parameter \PUBLIC_PARAM
end
attribute \blackbox 1
attribute \src "param_test.v:1"
module \stub
parameter \HIDDEN_PARAM
parameter \PUBLIC_PARAM
end
attribute \top 1
attribute \src "param_test.v:6"
module \testbench
attribute \module_not_derived 1
attribute \src "param_test.v:8"
cell \stub \no_param_stub
end
attribute \module_not_derived 1
attribute \src "param_test.v:10"
cell $paramod\stub\PUBLIC_PARAM=1 \one_param_stub
end
end
write_json 命令的输出甚至不包含有关HIDDEN_PARAM 参数的信息:
{
"creator": "Yosys 0.8+634 (git sha1 ac2fc3a, clang 3.8.0-2ubuntu4 -fPIC -Os)",
"modules": {
"$paramod\\stub\\PUBLIC_PARAM=1": {
"attributes": {
"blackbox": 1,
"src": "param_test.v:1"
},
"ports": {
},
"cells": {
},
"netnames": {
}
},
"stub": {
"attributes": {
"blackbox": 1,
"src": "param_test.v:1"
},
"ports": {
},
"cells": {
},
"netnames": {
}
},
"testbench": {
"attributes": {
"top": 1,
"src": "param_test.v:6"
},
"ports": {
},
"cells": {
"no_param_stub": {
"hide_name": 0,
"type": "stub",
"parameters": {
},
"attributes": {
"module_not_derived": 1,
"src": "param_test.v:8"
},
"port_directions": {
},
"connections": {
}
},
"one_param_stub": {
"hide_name": 0,
"type": "$paramod\\stub\\PUBLIC_PARAM=1",
"parameters": {
},
"attributes": {
"module_not_derived": 1,
"src": "param_test.v:10"
},
"port_directions": {
},
"connections": {
}
}
},
"netnames": {
}
}
}
}
【问题讨论】: