Implementing logarithmic function via Simulink HDL Coder
11 次查看(过去 30 天)
显示 更早的评论
I need to implement a logarithmic function in Simulink that can be used for generating HDL code using HDL Coder. The Log block in Simulink appears to only support native floating point data types for use with HDL Coder, and an evenly stepped LUT does not provide good enough precision per resources used.
Is there any other preferred way of implementing logarithmic functions in Simulink/HDL Coder?
0 个评论
回答(1 个)
Kiran Kintali
2024-3-25
Can you share a bit more about your application and requirements for log?
These results can be generated based on your target chip, latency constraints. I am sharing few sample details for basic log operation in single precision for your review.
>> openExample('hdlcoder/SynthesisBenchmarkOfNativeFloatingPointOperatorsExample')
>> load('hdlcoder_synthesis_benchmark.mat')
>> whos
Name Size Bytes Class Attributes
NFPSynthesisResults 1x1 339902 struct
>> NFPSynthesisResults.Vivado.HardwareDetails
Tool: 'Xilinx Vivado'
ChipFamily: 'Virtex7'
DeviceName: 'xc7v2000t'
PackageName: 'fhg1761'
SpeedValue: '-2'
Version: '2018.3'
>> NFPSynthesisResults.Vivado.MinLatency
Fmax Slices SliceRegs LUTs DSPs RAMs URAMs Latency DataPathDelay Slack LogicLevels LogicDelay RouteDelay
______ ______ _________ _____ ____ ____ _____ _______ _____________ ______ ___________ __________ __________
op_Log 235.29 661 1383 2072 5 0 0 20 4.25 -2.574 14 1.279 2.971
op_Log10 217.86 749 1210 2286 9 0 0 17 4.59 -2.619 15 1.647 2.943
op_Log10_Denorm_on 217.86 749 1210 2286 9 0 0 17 4.59 -2.619 15 1.647 2.943
op_Log2 287.19 667 1022 2054 6 0 0 16 3.482 -2.539 1 3.102 0.38
op_Log_Denorm_on 235.29 661 1383 2072 5 0 0 20 4.25 -2.574 14 1.279 2.971
You can generate more recent results using the instructions in the page.
2 个评论
Kiran Kintali
2024-4-12
Attaching sample algorithm that could be a starting point for your usecase. You can plugin the algorithm in a MATLAB function block.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 FPGA, ASIC, and SoC Development 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!