HDL Coder black box inclusion of module with parameterised packed input
이전 댓글 표시
Hi all! I am trying to wrap some existing code of the form:
module foo #(
parameter int NInputs = 2
)(
input wire [NInputs-1:0][31:0] foo_in,
output logic [31:0] foo_out
);
When I generate code with the appropriate black box settings to set NInputs and drive foo_in with a vector of the coresponding size, HDL Coder is generating code such as the following:
foo #(.NInputs(2)
)
u_i_foo (.In1_0(In1), // uint32
.In1_1(In2), // uint32
.Out1(i_foo_out1) // uint32
);
As you can see, HDL Coder is creating inappropriate port names instead of connecting a packed vector.
How should I set up the model / HDL Coder to correctly to concatenate the subsystem input ports in such a way to get a packed N-element signal to pass to the black box? I considered just using the Bit Concat block and then using the Extract Bits block within the model of the black box, but that seems like it would get very brittle in terms of data type and dimension handling...
댓글 수: 1
John
2020년 9월 28일
I'm interested in this question as well. Anyone have any thoughts on this?
답변 (1개)
Kiran Kintali
2020년 11월 1일
0 개 추천
>> I considered just using the Bit Concat block and then using the Extract Bits block within the model of the black box, but that seems like it would get very brittle in terms of data type and dimension handling...
It looks like since you are not able to generate code in certain style for bit packing you are going towards a blackbox route.
can you share a sample model to support@mathworks.com?
>> I am trying to wrap some existing code of the form:
Regarding black box question please refer to this documentation
web(fullfile(docroot, 'hdlcoder/ug/black-box-implementation-for-subsystem-blocks.html'))
considering using the recent feature to wrap in a Doc block to make it self-sufficient.
web(fullfile(docroot, 'hdlcoder/ug/integrate-custom-hdl-code-using-docblock.html'))
>> As you can see, HDL Coder is creating inappropriate port names instead of connecting a packed vector. How should I set up the model / HDL Coder to correctly to concatenate the subsystem input ports in such a way to get a packed N-element signal to pass to the black box?
The reason you are not seeing the correct types for the ports is because you used "uint32 (2)". Based on limited description I am assuming you would need 2-d array of boolean/ufix1 type at the interface.
카테고리
도움말 센터 및 File Exchange에서 HDL-Optimized Algorithm Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!