有没有办法通过Yosys获得verilog模块的默认参数值
我正在尝试使用Yosys命令shell获取verilog模块的默认参数值。 有什么办法吗? 此外,解析“write_ilang”命令输出文件是一个好主意,还是其格式在不久的将来会发生巨大变化 曾尝试在ilang、json、表转储中查找默认值,甚至使用有没有办法通过Yosys获得verilog模块的默认参数值,verilog,yosys,Verilog,Yosys,我正在尝试使用Yosys命令shell获取verilog模块的默认参数值。 有什么办法吗? 此外,解析“write_ilang”命令输出文件是一个好主意,还是其格式在不久的将来会发生巨大变化 曾尝试在ilang、json、表转储中查找默认值,甚至使用chparam-list命令,但没有得到任何结果 考虑以下示例(文件param_test.v): 我遵循以下步骤: 加载源代码read-sv param_test.v 精心设计层次结构-顶级测试台 尝试获取参数值 write_ilang命令的输出:
chparam-list
命令,但没有得到任何结果
考虑以下示例(文件param_test.v):
我遵循以下步骤:
read-sv param_test.v
层次结构-顶级测试台
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_参数的信息
参数:
{
"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": {
}
}
}
}
Yosys最近获得了通过细化保存参数的功能(而这些参数通常被丢弃)。将
-pwires
添加到read\u verilog
中,参数将转换为由参数默认值驱动的导线,参数
属性设置为1
就稳定性而言,还有其他几种工具(如nMigen)可以创建或读取RTLIL ilang,因此现在不太可能有重大突破性变化。感谢您的回答,不幸的是,
-pwires
标志未在文档中描述。我还发现了另一种通过C++ API获取参数初始值的方法。在精化之后,可以将Yosys::RTLIL::Module动态转换为Yosys::AST::AstModule,并访问其参数值。但是,我想这是一个糟糕的长期解决方案。仅供参考,-pwires
如果您运行帮助阅读_verilog
(并且将在0.9发布后出现在在线文档中。9)。
{
"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": {
}
}
}
}