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!