atlanswer / DSP-HW

Practice with TI C64x/C64x+ series DSP. 梁凡老师 DSP 器件原理与应用课程作业。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DSP-HW

中山大学电信院 EIT349 梁凡老师的 DSP 器件原理与应用课程作业(2020 秋)。
Homework for Principles and Applications of DSP Devices, SYSU SEIT, Fall 2020.

2x bilinear interpolation Demo:

Demo

512 x 1.5 resize function cycle count in different implementations (debug mode, optimization not enabled):

C float approach C int approach Linear assembly
1654442635 1027521855 60202045
YCbCr to RGB Conversion Demo:
Enter Y, Cb, Cr (comma seprated): 123, 123, 123
Y:123, Cb:123, Cr:123
-- C (floating-point multiply) ---> R:136, G:148, B:134 | took 2595 cycles.
-- Linear ASM (16-bit multiply) --> R:136, G:148, B:134 | took 38 cycles.
-- Linear ASM (8-bit multiply) ---> R:135, G:147, B:133 | took 39 cycles.

欢迎讨论

Useful resources

Documents:

Websites:

Homework List

  • 实验 1:用 C 语言实现 8 位 DIB 双线性插值 - task1-2 分支
  • 实验 2:双线性插值函数使用线性汇编语言实现 - task1-2 分支
  • 实验 3:用 C 语言和线性汇编语言完成从 YCbCr 彩色空间到 RGB 彩色空间的转换 - task3 分支
  • 实验 4:用 C 语言完成线性变换程序并优化 - task4 分支
  • 实验 5:用 C 语言和线性汇编语言实现中值滤波器 - task5 分支
  • 实验 6:通过 DSP/BIOS, 利用 C 语言完成工作 - task6 分支

Usage

Test environment

  • Code Composer Studio v8.3.1 on Windows 10 20H2
    • TI Code Gneration Tools v7.4.24 for tasks 1-5
    • TI Code Gneration Tools v7.4.23 for task 6
    • DSP/BIOS v5.42.02.10 for task 6

Note: Texas Instruments Simulators connection is required to run the CPU cycle accurate simulation without the actual development board, which was only existed in CCS prior to v6. This is the reason why the course recommended CCS v5, but it's quite old. However, there is a hack to migrate the software simulation to newer versions of CCS up to v8.3.1, thus I decided to use it. Code Generation Tools v7.4 is the last version of CGT to support C64/C64+, which was released in 2018.

The last version of DSP/BIOS is v5.42.02.10. Annoyingly, it's not working with CGT v7.4.24 as reported here. Roll back to CGT v7.4.23 or earlier to work with task6.

CCS Configuration

For task 1-5
  • Device:

    • Family: C6000
    • Variant: DaVinci DM64x, TMS320DM648
      Target configs are provided in the file targetConfigs/TMS320DM648.ccxml.
  • Tool-chain:

    • Output format: eabi (ELF)
    • Device endianness: little
    • Linker command file: DM648.cmd
      Modified linker command file is provided as DM648.cmd. L2RAM has been increased to 4MB.
  • Build

    • C6000 Compiler

      • Include Options: Add ${PROJECT_ROOT}/include
      • Performance Adviser: --advise:performance=all
      • Advanced Options
        • Assembler Options: --keep_asm
          Keep the intermediate assembly files to check software pipeline information.
    • C6000 Linker

      • Heap size for C/C++ dynamic memory allocation: --heap_size=0x200000

    The program uses malloc to dynamically allocate memory for the images. The .sysmem section of memory should be adjust to accommodate every images since the default size of 1KB is clearly not enough. More info about the cmd file could be found here.

For task 6
  • Device:
    • Family: C6000
    • Variant: DaVinci DM64x, DM642
      Target configs are provided in the file targetConfigs/EVMDM642.ccxml.
  • Tool-chain:
    • Output format: Legacy COFF
      C6000 EABI is not supported in DSP/BIOS.
    • Device endianness: little
    • Linker command file: <none>
      Memory allocation is controlled by the TCF file.
  • Build
    • C6000 Compiler
      • Include Options: Add ${PROJECT_ROOT}/include
Debug Configuration
  • Build
    • C6000 Compiler
      • Optimization: off
      • Debug Options: Full symbolic debug -g
      • Advanced Options
        • Predefined Symbols: --define=DEBUG
Release Configuration
  • Build
    • C6000 Compiler
      • Optimization: -O2
      • Debug Options: Symbolic debug for program analysis --symdebug:skeletal
      • Advanced Options
        • Predefined Symbols: --define=RELEASE
        • Runtime Model Options: Generate verbose software pipelining information --mw

Other options are assumed to be default.

How to run

Specific settings for each task
Task 1&2
  • Define USE_SA_IMPL to link resize function's linear assembly implementations, the C implementation would be used otherwise.
  • Define USE_INT to switch resize function's C implementation to its fixed-point multiplication approach, floating-point multiplication would be used otherwise.
Task 6
  • Use CGT v7.4.23 with DSP/BIOS v5.42.02.10
  • DSP-HW.tcf is provided to configure DSP/BIOS statically.

Code, build and hit debug!

About

Practice with TI C64x/C64x+ series DSP. 梁凡老师 DSP 器件原理与应用课程作业。

License:Apache License 2.0


Languages

Language:C 90.6%Language:Batchfile 9.4%