generatehdl

Сгенерируйте HDL-код для квантованного фильтра

Описание

пример

generatehdl(filtSO,'InputDataType',nt) генерирует HDL-код для заданной Системы фильтра object™ и тип входных данных, nt.

Сгенерированный файл является одним исходным файлом, который включает код архитектуры и объявление сущности. Можно найти этот файл в текущей рабочей папке в hdlsrc подпапка.

generatehdl(filtSO,'InputDataType',nt,'FractionalDelayDataType',fd) генерирует HDL-код для dsp.VariableFractionalDelay отфильтруйте Системный объект. Задайте тип входных данных, nt, и дробный тип данных задержки, fd.

generatehdl(filterObj) генерирует HDL-код для заданного dfilt объект фильтра с помощью настроек по умолчанию.

пример

generatehdl(___,Name,Value) использует дополнительные аргументы name-value, в дополнение к входным параметрам в предыдущих синтаксисах. Используйте эти свойства заменить настройки генерации HDL-кода по умолчанию.

  • Чтобы настроить имя фильтра, папка назначения, и задать выходной язык, видит Fundamental HDL Code Generation Properties.

  • Чтобы сконфигурировать коэффициенты, комплексные входные порты и дополнительные порты для определенных типов фильтра, видят HDL Filter Configuration Properties.

  • Чтобы оптимизировать скорость или область сгенерированного HDL-кода, смотрите HDL Optimization Properties.

  • Чтобы настроить порты, идентификаторы и комментарии, видят HDL Port and Identifier Properties.

  • Чтобы настроить построения HDL, смотрите HDL Construct Properties.

  • Чтобы сгенерировать и настроить испытательный стенд, смотрите HDL Test Bench Properties.

  • Чтобы интегрировать сторонние инструменты EDA в рабочий процесс создания фильтра, смотрите HDL Synthesis and Workflow Automation Properties.

Примеры

свернуть все

Спроектируйте прямую форму симметричный фильтр equiripple с этими техническими требованиями:

  • Нормированная частота полосы пропускания 0,2

  • Нормированная частота полосы задерживания 0,22

  • Неравномерность в полосе пропускания 1 дБ

  • Затухание в полосе задерживания 60 дБ

design функция возвращает dsp.FIRFilter Система object™, который реализует спецификацию.

filtSpecs = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.22,1,60);
FIRe = design(filtSpecs,'equiripple','FilterStructure','dfsymfir','SystemObject',true)
FIRe = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form symmetric'
      NumeratorSource: 'Property'
            Numerator: [-0.0011 -0.0017 -0.0025 -0.0031 -0.0031 -0.0024 ... ]
    InitialConditions: 0

  Show all properties

Чтобы сгенерировать HDL-код, вызовите generatehdl функция. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для входа с помощью свойства InputDataType. Кодер генерирует файл MyFilter.vhd в целевой папке по умолчанию, hdlsrc.

generatehdl(FIRe,'InputDataType',numerictype(1,16,15),'Name','MyFilter');
### Starting VHDL code generation process for filter: MyFilter
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex48836167/hdlsrc/MyFilter.vhd
### Starting generation of MyFilter VHDL entity
### Starting generation of MyFilter VHDL architecture
### Successful completion of VHDL code generation process for filter: MyFilter
### HDL latency is 2 samples

Спроектируйте прямую форму симметричный фильтр equiripple с этими техническими требованиями:

  • Нормированная частота полосы пропускания 0,2

  • Нормированная частота полосы задерживания 0,22

  • Неравномерность в полосе пропускания 1 дБ

  • Затухание в полосе задерживания 60 дБ

design функция возвращает dsp.FIRFilter Система object™, который реализует спецификацию.

filtSpecs = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.22,1,60);
FIRe = design(filtSpecs,'equiripple','FilterStructure','dfsymfir','SystemObject',true)
FIRe = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form symmetric'
      NumeratorSource: 'Property'
            Numerator: [-0.0011 -0.0017 -0.0025 -0.0031 -0.0031 -0.0024 ... ]
    InitialConditions: 0

  Show all properties

Сгенерируйте код VHDL и испытательный стенд VHDL для КИХ equiripple фильтр. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для типа входных данных. Кодер генерирует файлы MyFilter.vhd и MyFilterTB.vhd в целевой папке по умолчанию, hdlsrc.

generatehdl(FIRe,'InputDataType',numerictype(1,16,15),'Name','MyFilter',...
    'GenerateHDLTestbench','on','TestBenchName','MyFilterTB')
### Starting VHDL code generation process for filter: MyFilter
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex63281302/hdlsrc/MyFilter.vhd
### Starting generation of MyFilter VHDL entity
### Starting generation of MyFilter VHDL architecture
### Successful completion of VHDL code generation process for filter: MyFilter
### HDL latency is 2 samples
### Starting generation of VHDL Test Bench.
### Generating input stimulus
### Done generating input stimulus; length 4486 samples.
### Generating Test bench: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex63281302/hdlsrc/MyFilterTB.vhd
### Creating stimulus vectors ...
### Done generating VHDL Test Bench.

Спроектируйте прямую форму симметричный фильтр equiripple с полностью параллельной архитектурой (по умолчанию) и программируемыми коэффициентами. design функция возвращает dsp.FIRFilter Система object™ с lowpass по умолчанию фильтрует спецификацию.

firfilt = design(fdesign.lowpass,'equiripple','FilterStructure','dfsymfir','SystemObject',true)
firfilt = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form symmetric'
      NumeratorSource: 'Property'
            Numerator: [-0.0024 -0.0021 0.0068 0.0167 0.0111 -0.0062 ... ]
    InitialConditions: 0

  Show all properties

Чтобы сгенерировать HDL-код, вызовите generatehdl функция. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для входных данных. Чтобы сгенерировать интерфейс процессора для коэффициентов, необходимо задать дополнительный аргумент пары "имя-значение".

generatehdl(firfilt,'InputDataType',numerictype(1,16,15),'CoefficientSource','ProcessorInterface')
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex74213987/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 2 samples

Кодер генерирует эту сущность VHDL для объекта фильтра.

Создайте прямую форму антисимметричный фильтр с коэффициентами:

coeffs = fir1(22,0.45);
firfilt = dsp.FIRFilter('Numerator',coeffs,'Structure','Direct form antisymmetric')
firfilt = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form antisymmetric'
      NumeratorSource: 'Property'
            Numerator: [3.6133e-04 0.0031 8.4473e-04 -0.0090 -0.0072 ... ]
    InitialConditions: 0

  Show all properties

Чтобы сгенерировать HDL-код, вызовите generatehdl функция. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для входных данных. Чтобы сгенерировать частично последовательную архитектуру, задайте последовательный раздел. Включить CoefficientMemory свойство, необходимо установить CoefficientSource к ProcessorInterface.

generatehdl(firfilt,'InputDataType',numerictype(1,16,15), ...
    'SerialPartition',[7 4],'CoefficientMemory','DualPortRAMs', ...
    'CoefficientSource','ProcessorInterface')
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex21465785/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Clock rate is 7 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 3 samples

Сгенерированный код включает двухпортовый интерфейс RAM для программируемых коэффициентов.

Исследуйте тактовую частоту и задержку для различных последовательных реализаций того же фильтра. Используя симметричную структуру также позволяет логике фильтра совместно использовать множители для симметричных коэффициентов.

Создайте прямую форму симметричный КИХ-фильтр с этими техническими требованиями:

  • Порядок фильтра 13

  • Нормированная частота среза 0,4 для точки на 6 дБ

design функция возвращает dsp.FIRFilter Система object™, который реализует спецификацию.

FIR = design(fdesign.lowpass('N,Fc',13,.4),'FilterStructure','dfsymfir','SystemObject',true)
FIR = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form symmetric'
      NumeratorSource: 'Property'
            Numerator: [0.0037 0.0045 -0.0115 -0.0417 1.0911e-17 0.1776 ... ]
    InitialConditions: 0

  Show all properties

Чтобы сгенерировать HDL-код, вызовите generatehdl функция. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для входных данных.

Для базового сравнения сначала сгенерируйте полностью параллельную архитектуру по умолчанию.

generatehdl(FIR,'Name','FullyParallel', ...
    'InputDataType',numerictype(1,16,15))
### Starting VHDL code generation process for filter: FullyParallel
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex94948885/hdlsrc/FullyParallel.vhd
### Starting generation of FullyParallel VHDL entity
### Starting generation of FullyParallel VHDL architecture
### Successful completion of VHDL code generation process for filter: FullyParallel
### HDL latency is 2 samples

Сгенерируйте полностью последовательную архитектуру путем установки размера раздела на эффективную длину фильтра. Уровень системных часов является шесть раз входной частотой дискретизации. Задержка HDL, о которой сообщают, является одной выборкой, больше, чем параллельная реализация по умолчанию.

generatehdl(FIR,'SerialPartition',6,'Name','FullySerial', ...
    'InputDataType',numerictype(1,16,15))
### Starting VHDL code generation process for filter: FullySerial
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex94948885/hdlsrc/FullySerial.vhd
### Starting generation of FullySerial VHDL entity
### Starting generation of FullySerial VHDL architecture
### Clock rate is 6 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: FullySerial
### HDL latency is 3 samples

Сгенерируйте частично последовательную архитектуру с тремя равными разделами. Эта архитектура использует три множителя. Тактовая частота является два раза входным уровнем, и задержка совпадает с параллельной реализацией по умолчанию.

generatehdl(FIR,'SerialPartition',[2 2 2],'Name','PartlySerial', ...
    'InputDataType',numerictype(1,16,15))
### Starting VHDL code generation process for filter: PartlySerial
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex94948885/hdlsrc/PartlySerial.vhd
### Starting generation of PartlySerial VHDL entity
### Starting generation of PartlySerial VHDL architecture
### Clock rate is 2 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: PartlySerial
### HDL latency is 3 samples

Сгенерируйте каскадно-последовательную архитектуру путем включения повторного использования аккумулятора. Задайте эти три раздела в порядке убывания размера. Заметьте, что тактовая частота выше, чем уровень в частично последовательный (без повторного использования аккумулятора) пример.

generatehdl(FIR,'SerialPartition',[3 2 1],'ReuseAccum','on','Name','CascadeSerial', ...
    'InputDataType',numerictype(1,16,15))
### Starting VHDL code generation process for filter: CascadeSerial
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex94948885/hdlsrc/CascadeSerial.vhd
### Starting generation of CascadeSerial VHDL entity
### Starting generation of CascadeSerial VHDL architecture
### Clock rate is 4 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: CascadeSerial
### HDL latency is 3 samples

Можно также сгенерировать каскадно-последовательную архитектуру, не задавая разделы явным образом. Кодер автоматически выбирает размеры раздела.

generatehdl(FIR,'ReuseAccum','on','Name','CascadeSerial', ...
    'InputDataType',numerictype(1,16,15))
### Starting VHDL code generation process for filter: CascadeSerial
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex94948885/hdlsrc/CascadeSerial.vhd
### Starting generation of CascadeSerial VHDL entity
### Starting generation of CascadeSerial VHDL architecture
### Clock rate is 4 times the input sample rate for this architecture.
### Serial partition # 1 has 3 inputs.
### Serial partition # 2 has 3 inputs.
### Successful completion of VHDL code generation process for filter: CascadeSerial
### HDL latency is 3 samples

Создайте 2D этап расположенный каскадом фильтр с этими техническими требованиями для каждого этапа фильтра:

  • Прямая форма симметричный КИХ-фильтр

  • Порядок фильтра 8

  • Нормированная частота среза 0,4 для точки на 6 дБ

Каждый вызов design функция возвращает dsp.FIRFilter Система object™, который реализует спецификацию. cascade функция возвращает 2D этап расположенный каскадом фильтр.

lp = design(fdesign.lowpass('N,Fc',8,.4),'FilterStructure','dfsymfir','SystemObject',true)
lp = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form symmetric'
      NumeratorSource: 'Property'
            Numerator: [-0.0061 -0.0136 0.0512 0.2657 0.4057 0.2657 ... ]
    InitialConditions: 0

  Show all properties

hp = design(fdesign.highpass('N,Fc',8,.4),'FilterStructure','dfsymfir','SystemObject',true)
hp = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form symmetric'
      NumeratorSource: 'Property'
            Numerator: [0.0060 0.0133 -0.0501 -0.2598 0.5951 -0.2598 ... ]
    InitialConditions: 0

  Show all properties

casc = cascade(lp,hp)
casc = 
  dsp.FilterCascade with properties:

    Stage1: [1x1 dsp.FIRFilter]
    Stage2: [1x1 dsp.FIRFilter]

Чтобы сгенерировать HDL-код, вызовите generatehdl функция для каскадного фильтра. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для входных данных.

Задайте различные разделы для каждого каскадного этапа как массив ячеек.

generatehdl(casc,'InputDataType',numerictype(1,16,15),'SerialPartition',{[3 2],[4 1]})
### Starting VHDL code generation process for filter: casfilt
### Cascade stage # 1
### Starting VHDL code generation process for filter: casfilt_stage1
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex16715237/hdlsrc/casfilt_stage1.vhd
### Starting generation of casfilt_stage1 VHDL entity
### Starting generation of casfilt_stage1 VHDL architecture
### Clock rate is 3 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage1
### Cascade stage # 2
### Starting VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex16715237/hdlsrc/casfilt_stage2.vhd
### Starting generation of casfilt_stage2 VHDL entity
### Starting generation of casfilt_stage2 VHDL architecture
### Clock rate is 4 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex16715237/hdlsrc/casfilt.vhd
### Starting generation of casfilt VHDL entity
### Starting generation of casfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt
### HDL latency is 2 samples

Чтобы исследовать эффективную длину фильтра и опции разделения для каждого этапа фильтра каскада, вызовите hdlfilterserialinfo функция. Функция возвращает соответствие вектора раздела желаемому количеству множителей. Запросите последовательные возможности раздела для первой стадии и выберите много множителей.

hdlfilterserialinfo(casc.Stage1,'InputDataType',numerictype(1,16,15))
   | Total Coefficients | Zeros | A/Symm | Effective |
   ---------------------------------------------------
   |          9         |   0   |    4   |     5     |

Effective filter length for SerialPartition value is 5.

  Table of 'SerialPartition' values with corresponding values of 
  folding factor and number of multipliers for the given filter.

   | Folding Factor | Multipliers | SerialPartition |
   --------------------------------------------------
   |        1       |      5      |[1 1 1 1 1]      |
   |        2       |      3      |[2 2 1]          |
   |        3       |      2      |[3 2]            |
   |        4       |      2      |[4 1]            |
   |        5       |      1      |[5]              |

Выберите последовательный вектор раздела для цели двух множителей и передайте векторы generatehdl функция. При вызывании функции, этот путь возвращает первый возможный вектор раздела, но существует несколько векторов раздела, которые достигают архитектуры 2D множителя. Каждый этап использует различную тактовую частоту на основе количества множителей. Кодер генерирует контроллер синхронизации, чтобы вывести эти часы.

sp1 = hdlfilterserialinfo(casc.Stage1,'InputDataType',numerictype(1,16,15),'Multiplier',2)
sp1 = 1×2

     3     2

sp2 = hdlfilterserialinfo(casc.Stage2,'InputDataType',numerictype(1,16,15),'Multiplier',3)
sp2 = 1×3

     2     2     1

generatehdl(casc,'InputDataType',numerictype(1,16,15),'SerialPartition',{sp1,sp2})
### Starting VHDL code generation process for filter: casfilt
### Cascade stage # 1
### Starting VHDL code generation process for filter: casfilt_stage1
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex16715237/hdlsrc/casfilt_stage1.vhd
### Starting generation of casfilt_stage1 VHDL entity
### Starting generation of casfilt_stage1 VHDL architecture
### Clock rate is 3 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage1
### Cascade stage # 2
### Starting VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex16715237/hdlsrc/casfilt_stage2.vhd
### Starting generation of casfilt_stage2 VHDL entity
### Starting generation of casfilt_stage2 VHDL architecture
### Clock rate is 2 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex16715237/hdlsrc/casfilt.vhd
### Starting generation of casfilt VHDL entity
### Starting generation of casfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt
### HDL latency is 2 samples

Создайте прямую форму I фильтров SOS с этими техническими требованиями:

  • Частота дискретизации 48 кГц

  • Порядок фильтра 5

  • Частота среза 10,8 кГц для точки на 3 дБ

design функция возвращает dsp.BiquadFilter Система object™, который реализует спецификацию. Пользовательский тип данных аккумулятора избегает ошибки квантования.

Fs = 48e3;
Fc = 10.8e3;
N = 5;
lp = design(fdesign.lowpass('n,f3db',N,Fc,Fs),'butter', ...
    'FilterStructure','df1sos','SystemObject',true) 
lp = 
  dsp.BiquadFilter with properties:

                       Structure: 'Direct form I'
                 SOSMatrixSource: 'Property'
                       SOSMatrix: [3x6 double]
                     ScaleValues: [4x1 double]
      NumeratorInitialConditions: 0
    DenominatorInitialConditions: 0
        OptimizeUnityScaleValues: true

  Show all properties

nt_accum = numerictype('Signedness','auto','WordLength',20, ...
    'FractionLength',15);
nt_input = numerictype(1,16,15);
lp.NumeratorAccumulatorDataType = 'Custom';
lp.CustomNumeratorAccumulatorDataType = nt_accum;
lp.DenominatorAccumulatorDataType = 'Custom';
lp.CustomDenominatorAccumulatorDataType = nt_accum;

Чтобы перечислить все возможные последовательные технические требования архитектуры для этого фильтра, вызовите hdlfilterserialinfo функция. Когда фильтром является Системный объект, необходимо задать тип данных с фиксированной точкой для входных данных.

hdlfilterserialinfo(lp,'InputDataType',nt_input)
  Table of folding factors with corresponding number of multipliers for the given filter.

   | Folding factor | Multipliers |
   --------------------------------
   |        6       |      3      |
   |        9       |      2      |
   |       18       |      1      |

Чтобы сгенерировать HDL-код, вызовите generatehdl функция с одной из последовательных архитектур. Задайте любого NumMultipliers или FoldingFactor свойство, но не оба. Например, использование NumMultipliers свойство:

generatehdl(lp,'NumMultipliers',2,'InputDataType',nt_input)
### Starting VHDL code generation process for filter: lp
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex90334139/hdlsrc/lp.vhd
### Starting generation of lp VHDL entity
### Starting generation of lp VHDL architecture
### Successful completion of VHDL code generation process for filter: lp
### HDL latency is 2 samples

В качестве альтернативы задайте ту же архитектуру с FoldingFactor свойство.

generatehdl(lp,'FoldingFactor',9,'InputDataType',nt_input)
### Starting VHDL code generation process for filter: lp
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex90334139/hdlsrc/lp.vhd
### Starting generation of lp VHDL entity
### Starting generation of lp VHDL architecture
### Successful completion of VHDL code generation process for filter: lp
### HDL latency is 2 samples

Обе этих команды генерируют фильтр, который использует в общей сложности два множителя с задержкой девяти тактов. Эта архитектура использует меньше области, чем параллельная реализация, за счет задержки.

Используйте распределенные арифметические опции, чтобы сократить количество множителей в реализации фильтра.

Создайте КИХ-фильтр прямой формы и вычислите длину фильтра, FL.

filtdes = fdesign.lowpass('N,Fc,Ap,Ast',30,0.4,0.05,0.03,'linear');
firfilt = design(filtdes,'FilterStructure','dffir','SystemObject',true);
FL = length(find(firfilt.Numerator ~= 0))
FL = 31

Задайте набор разделов, таким образом, что размеры раздела составляют в целом длину фильтра. Это - всего одна опция раздела, можно задать другие комбинации размеров.

generatehdl(firfilt,'InputDataType',numerictype(1,16,15), ...
    'DALUTPartition',[8 8 8 7])
Warning: Structure fir has symmetric coefficients, consider converting to structure symmetricfir for reduced area.
Warning: Structure fir has symmetric coefficients, consider converting to structure symmetricfir for reduced area.
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex00198568/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Clock rate is 16 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 3 samples

Для сравнения создайте прямую форму симметричный КИХ-фильтр. Длина фильтра меньше в симметричном случае.

filtdes = fdesign.lowpass('N,Fc,Ap,Ast',30,0.4,0.05,0.03,'linear');
firfilt = design(filtdes,'FilterStructure','dfsymfir','SystemObject',true);
FL = ceil(length(find(firfilt.Numerator ~= 0))/2)
FL = 16

Задайте набор разделов, таким образом, что размеры раздела составляют в целом длину фильтра. Это - всего одна опция раздела, можно задать другие комбинации размеров. Совет: Используйте hdlfilterdainfo функционируйте, чтобы отобразить эффективную длину фильтра, опции разделения LUT и возможный DARadix значения для фильтра.

generatehdl(firfilt,'InputDataType',numerictype(1,16,15), ...
    'DALUTPartition',[8 8])
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex00198568/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Clock rate is 17 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 3 samples

Используйте распределенные арифметические опции, чтобы сократить количество множителей в реализации фильтра.

Создайте КИХ прямой формы многофазный decimator и вычислите длину фильтра.

d = fdesign.decimator(4);
filt = design(d,'SystemObject',true);
FL = size(polyphase(filt),2)
FL = 27

Задайте распределенные арифметические разделы LUT, которые составляют в целом размер фильтра. Когда вы задаете разделы как вектор для многофазного фильтра, каждый подфильтр использует те же разделы.

generatehdl(filt,'InputDataType',numerictype(1,16,15), ...
    'DALUTPartition',[8 8 8 3])
### Starting VHDL code generation process for filter: firdecim
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex51670151/hdlsrc/firdecim.vhd
### Starting generation of firdecim VHDL entity
### Starting generation of firdecim VHDL architecture
### Clock rate is 4 times the input and 16 times the output sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: firdecim
### HDL latency is 16 samples

Можно также задать уникальные разделы для каждого подфильтра. Для того же фильтра задайте подфильтр, делящий как матрица. Длина первого подфильтра равняется 1, и другие подфильтры имеют длину 26. Совет: Используйте hdlfilterdainfo функционируйте, чтобы отобразить эффективную длину фильтра, опции разделения LUT и возможный DARadix значения для фильтра.

d = fdesign.decimator(4);
filt = design(d,'SystemObject',true);
generatehdl(filt,'InputDataType',numerictype(1,16,15), ...
    'DALUTPartition',[1 0 0 0; 8 8 8 2; 8 8 6 4; 8 8 8 2])
### Starting VHDL code generation process for filter: firdecim
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex51670151/hdlsrc/firdecim.vhd
### Starting generation of firdecim VHDL entity
### Starting generation of firdecim VHDL architecture
### Clock rate is 4 times the input and 16 times the output sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: firdecim
### HDL latency is 16 samples

Используйте распределенные арифметические опции, чтобы сократить количество множителей в реализации фильтра.

Создайте каскадный фильтр

Создайте 2D этап расположенный каскадом фильтр. Задайте различные разделы LUT для каждого этапа и задайте векторы раздела в массиве ячеек.

lp = design(fdesign.lowpass('N,Fc',8,.4),'filterstructure','dfsymfir', ...
    'SystemObject',true);
hp = design(fdesign.highpass('N,Fc',8,.4),'filterstructure','dfsymfir', ...
    'SystemObject',true);
casc = cascade(lp,hp);
nt1 = numerictype(1,12,10);
generatehdl(casc,'InputDataType',nt1,'DALUTPartition',{[3 2],[2 2 1]})
### Starting VHDL code generation process for filter: casfilt
### Cascade stage # 1
### Starting VHDL code generation process for filter: casfilt_stage1
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt_stage1.vhd
### Starting generation of casfilt_stage1 VHDL entity
### Starting generation of casfilt_stage1 VHDL architecture
### Clock rate is 13 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage1
### Cascade stage # 2
### Starting VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt_stage2.vhd
### Starting generation of casfilt_stage2 VHDL entity
### Starting generation of casfilt_stage2 VHDL architecture
### Clock rate is 29 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt.vhd
### Starting generation of casfilt VHDL entity
### Starting generation of casfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt
### HDL latency is 4 samples

Распределенные арифметические опции

Используйте hdlfilterdainfo функционируйте, чтобы отобразить эффективную длину фильтра, опции разделения LUT и возможный DARadix значения для каждого этапа фильтра каскада. Функция возвращает соответствие вектора раздела LUT желаемому количеству адресных битов.

Запросите возможности раздела LUT для первой стадии.

 hdlfilterdainfo(casc.Stage1,'InputDataType',nt1);
   | Total Coefficients | Zeros | A/Symm | Effective |
   ---------------------------------------------------
   |          9         |   0   |    4   |     5     |

Effective filter length for SerialPartition value is 5.

  Table of 'DARadix' values with corresponding values of 
  folding factor and multiple for LUT sets for the given filter.

   | Folding Factor | LUT-Sets Multiple | DARadix |
   ------------------------------------------------
   |        1       |         12        |   2^12  |
   |        3       |         6         |   2^6   |
   |        4       |         4         |   2^4   |
   |        5       |         3         |   2^3   |
   |        7       |         2         |   2^2   |
   |       13       |         1         |   2^1   |

  Details of LUTs with corresponding 'DALUTPartition' values.

   | Max Address Width | Size(bits) |      LUT Details      | DALUTPartition |
   ---------------------------------------------------------------------------
   |         5         |     416    |1x32x13                |[5]             |
   |         4         |     216    |1x16x12, 1x2x12        |[4 1]           |
   |         3         |     124    |1x4x13, 1x8x9          |[3 2]           |
   |         2         |     104    |1x2x12, 1x4x12, 1x4x8  |[2 2 1]         |

Notes:
1. LUT Details indicates number of LUTs with their sizes. e.g. 1x1024x18
   implies 1 LUT of 1024 18-bit wide locations.

Чтобы запросить возможности раздела LUT для второго этапа, необходимо сначала определить тип входных данных второго этапа.

y = casc.Stage1(fi(0,nt1));
nt2 = y.numerictype;
hdlfilterdainfo(casc.Stage2,'InputDataType',nt2);
   | Total Coefficients | Zeros | A/Symm | Effective |
   ---------------------------------------------------
   |          9         |   0   |    4   |     5     |

Effective filter length for SerialPartition value is 5.

  Table of 'DARadix' values with corresponding values of 
  folding factor and multiple for LUT sets for the given filter.

   | Folding Factor | LUT-Sets Multiple | DARadix |
   ------------------------------------------------
   |        1       |         28        |   2^28  |
   |        3       |         14        |   2^14  |
   |        5       |         7         |   2^7   |
   |        8       |         4         |   2^4   |
   |       15       |         2         |   2^2   |
   |       29       |         1         |   2^1   |

  Details of LUTs with corresponding 'DALUTPartition' values.

   | Max Address Width | Size(bits) |       LUT Details      | DALUTPartition |
   ----------------------------------------------------------------------------
   |         5         |     896    |1x32x28                 |[5]             |
   |         4         |     488    |1x16x27, 1x2x28         |[4 1]           |
   |         3         |     304    |1x4x28, 1x8x24          |[3 2]           |
   |         2         |     256    |1x2x28, 1x4x23, 1x4x27  |[2 2 1]         |

Notes:
1. LUT Details indicates number of LUTs with their sizes. e.g. 1x1024x18
   implies 1 LUT of 1024 18-bit wide locations.

Различные разделы LUT для каждого этапа

Выберите ширины адреса и складные факторы, чтобы получить раздел LUT для каждого этапа. Первая стадия использует размер адреса имеющий LUTs пяти битов. Второй этап использует размер адреса имеющий LUTs трех битов. Они запускаются на той же тактовой частоте и имеют различные разделы LUT.

dp1 = hdlfilterdainfo(casc.Stage1,'InputDataType',nt1, ...
    'LUTInputs',5,'FoldingFactor',3);
dp2 = hdlfilterdainfo(casc.Stage2,'InputDataType',nt1, ...
    'LUTInputs',3,'FoldingFactor',5);
generatehdl(casc,'InputDataType',nt1,'DALUTPartition',{dp1,dp2});
### Starting VHDL code generation process for filter: casfilt
### Cascade stage # 1
### Starting VHDL code generation process for filter: casfilt_stage1
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt_stage1.vhd
### Starting generation of casfilt_stage1 VHDL entity
### Starting generation of casfilt_stage1 VHDL architecture
### Clock rate is 13 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage1
### Cascade stage # 2
### Starting VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt_stage2.vhd
### Starting generation of casfilt_stage2 VHDL entity
### Starting generation of casfilt_stage2 VHDL architecture
### Clock rate is 29 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt.vhd
### Starting generation of casfilt VHDL entity
### Starting generation of casfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt
### HDL latency is 4 samples

Различный DARadix Значения для каждого этапа

Можно также задать различный DARadix значения для каждого просачиваются каскад. Можно только задать различные каскадные разделы на командной строке. Когда вы задаете разделы в диалоговом окне Generate HDL, все каскадные этапы используют те же разделы. Смотрите результаты hdlfilterdainfo установить DARadix значения для каждого этапа.

generatehdl(casc,'InputDataType',nt1, ...
'DALUTPartition',{[3 2],[2 2 1]},'DARadix',{2^3,2^7})
### Starting VHDL code generation process for filter: casfilt
### Cascade stage # 1
### Starting VHDL code generation process for filter: casfilt_stage1
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt_stage1.vhd
### Starting generation of casfilt_stage1 VHDL entity
### Starting generation of casfilt_stage1 VHDL architecture
### Clock rate is 5 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage1
### Cascade stage # 2
### Starting VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt_stage2.vhd
### Starting generation of casfilt_stage2 VHDL entity
### Starting generation of casfilt_stage2 VHDL architecture
### Clock rate is 5 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex17169310/hdlsrc/casfilt.vhd
### Starting generation of casfilt VHDL entity
### Starting generation of casfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt
### HDL latency is 4 samples

Задайте различные архитектуры фильтра для различных этапов каскадного фильтра. Можно задать соединение последовательной, распределенной арифметики (DA) и найти что-либо подобное архитектурам в зависимости от аппаратных ограничений.

Создайте каскадный фильтр

Создайте трехэтапный фильтр. Каждый этап является другим типом.

h1 = dsp.FIRFilter('Numerator',[0.05 -.25 .88 0.9 .88 -.25 0.05]);
h2 = dsp.FIRFilter('Numerator',[-0.008 0.06 -0.44 0.44 -0.06 0.008], ...
    'Structure','Direct form antisymmetric');
h3 = dsp.FIRFilter('Numerator',[-0.008 0.06 0.44 0.44 0.06 -0.008], ...
    'Structure','Direct form symmetric');
casc = cascade(h1,h2,h3);

Задайте архитектуру для каждого этапа

Задайте архитектуру DA для первой стадии, последовательную архитектуру для второго этапа и полностью параллельную архитектуру (по умолчанию) для третьей стадии.

Получить DARadix значения для первой архитектуры, используйте hdlfilterdainfo, затем выберите значение от dr.

nt = numerictype(1,12,10);
[dp,dr,lutsize,ff] = hdlfilterdainfo(casc.Stage1, ...
    'InputDataType',numerictype(1,12,10));
dr
dr = 6x1 cell
    {'2^12'}
    {'2^6' }
    {'2^4' }
    {'2^3' }
    {'2^2' }
    {'2^1' }

Установите значения свойств как массивы ячеек, где каждая ячейка применяется к этапу. Чтобы отключить свойство для конкретного этапа, используйте значения по умолчанию (-1 для разделов и 2 для DARadix).

generatehdl(casc,'InputDataType',nt, ...
    'SerialPartition',{-1,3,-1}, ...
    'DALUTPartition',{[4 3],-1,-1}, ...
    'DARadix',{2^6,2,2});
Warning: Structure fir has symmetric coefficients, consider converting to structure symmetricfir for reduced area.
Warning: Structure fir has symmetric coefficients, consider converting to structure symmetricfir for reduced area.
Warning: Structure fir has symmetric coefficients, consider converting to structure symmetricfir for reduced area.
### Starting VHDL code generation process for filter: casfilt
### Cascade stage # 1
### Starting VHDL code generation process for filter: casfilt_stage1
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex13094988/hdlsrc/casfilt_stage1.vhd
### Starting generation of casfilt_stage1 VHDL entity
### Starting generation of casfilt_stage1 VHDL architecture
### Clock rate is 2 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage1
### Cascade stage # 2
### Starting VHDL code generation process for filter: casfilt_stage2
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex13094988/hdlsrc/casfilt_stage2.vhd
### Starting generation of casfilt_stage2 VHDL entity
### Starting generation of casfilt_stage2 VHDL architecture
### Clock rate is 3 times the input sample rate for this architecture.
### Successful completion of VHDL code generation process for filter: casfilt_stage2
### Cascade stage # 3
### Starting VHDL code generation process for filter: casfilt_stage3
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex13094988/hdlsrc/casfilt_stage3.vhd
### Starting generation of casfilt_stage3 VHDL entity
### Starting generation of casfilt_stage3 VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt_stage3
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex13094988/hdlsrc/casfilt.vhd
### Starting generation of casfilt VHDL entity
### Starting generation of casfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: casfilt
### HDL latency is 3 samples

Можно задать входные коэффициенты, чтобы протестировать фильтр с программируемыми коэффициентами.

Создайте прямую форму симметричный КИХ-фильтр с полностью параллельной архитектурой (по умолчанию). Задайте коэффициенты для объекта фильтра в векторном b. Кодер генерирует код испытательного стенда, чтобы протестировать содействующий интерфейс использование второго набора коэффициентов, c. Кодер обрезает c к эффективной длине фильтра.

b = [-0.01 0.1 0.8 0.1 -0.01];
c = [-0.03 0.5 0.7 0.5 -0.03];
c = c(1:ceil(length(c)/2));
filt = dsp.FIRFilter('Numerator',b,'Structure','Direct form symmetric');
generatehdl(filt,'InputDataType',numerictype(1,16,15), ...
    'GenerateHDLTestbench','on', ...
    'CoefficientSource','ProcessorInterface','TestbenchCoeffStimulus',c)
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex66247050/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 2 samples
### Starting generation of VHDL Test Bench.
### Generating input stimulus
### Done generating input stimulus; length 3107 samples.
### Generating Test bench: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex66247050/hdlsrc/firfilt_tb.vhd
### Creating stimulus vectors ...
### Done generating VHDL Test Bench.

Создайте спецификацию фильтра. Когда вы генерируете HDL-код, задаете программируемый интерфейс для коэффициентов.

Fs = 48e3;  
Fc = 10.8e3;
N = 5;
f_lp = fdesign.lowpass('n,f3db',N,Fc,Fs);
filtiir = design(f_lp,'butter','FilterStructure','df2sos','SystemObject',true);
filtiir.OptimizeUnityScaleValues = 0;
generatehdl(filtiir,'InputDataType',numerictype(1,16,15), ...
    'CoefficientSource','ProcessorInterface')
### Starting VHDL code generation process for filter: filtiir
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex92389569/hdlsrc/filtiir.vhd
### Starting generation of filtiir VHDL entity
### Starting generation of filtiir VHDL architecture
### Second-order section, # 1
### Second-order section, # 2
### First-order section, # 3
### Successful completion of VHDL code generation process for filter: filtiir
### HDL latency is 2 samples

Кодер генерирует эту сущность VHDL для объекта фильтра.

Исследуйте различные способы задать порты часов для многоскоростных фильтров.

Настройка по умолчанию

Создайте многофазный конвертер частоты дискретизации. По умолчанию кодер генерирует одни входные часы (clk), входные часы включают (clk_enable), и часы включают выходной сигнал под названием ce_out. ce_out сигнал указывает, когда выходная выборка готова. ce_in выходной сигнал указывает, когда входная выборка была принята. Можно использовать этот сигнал управлять восходящим потоком данных.

firrc = dsp.FIRRateConverter('InterpolationFactor',5,'DecimationFactor',3);
generatehdl(firrc,'InputDataType',numerictype(1,16,15))
### Starting VHDL code generation process for filter: firrc
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex09049114/hdlsrc/firrc.vhd
### Starting generation of firrc VHDL entity
### Starting generation of firrc VHDL architecture
### Successful completion of VHDL code generation process for filter: firrc
### HDL latency is 2 samples

Сгенерированная сущность имеет следующие сигналы:

Пользовательские имена часов

Можно обеспечить, пользовательские имена для входных часов включают, и выходные часы включают сигналы. Вы не можете переименовать ce_in сигнал.

firrc = dsp.FIRRateConverter('InterpolationFactor',5,'DecimationFactor',3)
firrc = 
  dsp.FIRRateConverter with properties:

    InterpolationFactor: 5
       DecimationFactor: 3
        NumeratorSource: 'Property'
              Numerator: [0 -6.6976e-05 -1.6044e-04 -2.2552e-04 ... ]

  Show all properties

generatehdl(firrc,'InputDataType',numerictype(1,16,15),...
            'ClockEnableInputPort','clk_en1', ...
            'ClockEnableOutputPort','clk_en2')
### Starting VHDL code generation process for filter: firrc
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex09049114/hdlsrc/firrc.vhd
### Starting generation of firrc VHDL entity
### Starting generation of firrc VHDL architecture
### Successful completion of VHDL code generation process for filter: firrc
### HDL latency is 2 samples

Сгенерированная сущность имеет следующие сигналы:

Несколько входных параметров часов

Чтобы сгенерировать несколько входных сигналов часов для поддерживаемого многоскоростного фильтра, установите ClockInputs свойство к 'Multiple'. В этом случае кодер не генерирует выходных часов, включают порты.

decim = dsp.CICDecimator(7,1,4);
generatehdl(decim,'InputDataType',numerictype(1,16,15), ...
    'ClockInputs','Multiple')
### Starting VHDL code generation process for filter: cicDecOrIntFilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex09049114/hdlsrc/cicDecOrIntFilt.vhd
### Starting generation of cicDecOrIntFilt VHDL entity
### Starting generation of cicDecOrIntFilt VHDL architecture
### Section # 1 : Integrator
### Section # 2 : Integrator
### Section # 3 : Integrator
### Section # 4 : Integrator
### Section # 5 : Comb
### Section # 6 : Comb
### Section # 7 : Comb
### Section # 8 : Comb
### Successful completion of VHDL code generation process for filter: cicDecOrIntFilt
### HDL latency is 7 samples

Сгенерированная сущность имеет следующие сигналы:

Создайте объект фильтра. Затем вызовите generatehdl , и задайте инструмент синтеза.

lpf = fdesign.lowpass('fp,fst,ap,ast',0.45,0.55,1,60);
firfilt = design(lpf,'equiripple','FilterStructure','dfsymfir', ...
    'SystemObject',true);
generatehdl(firfilt,'InputDataType',numerictype(1,14,13), ...
    'HDLSynthTool','Quartus');
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex92219095/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 2 samples

Кодер генерирует файл с именем скрипта firfilt_quartus.tcl, использование свойств скрипта по умолчанию для инструмента синтеза Altera® Quartus II.

type hdlsrc/firfilt_quartus.tcl
load_package flow
set top_level firfilt
set src_dir "./hdlsrc"
set prj_dir "q2dir"
file mkdir ../$prj_dir
cd ../$prj_dir
project_new $top_level -revision $top_level -overwrite
set_global_assignment -name FAMILY "Stratix II"
set_global_assignment -name DEVICE EP2S60F484C3
set_global_assignment -name TOP_LEVEL_ENTITY $top_level
set_global_assignment -name vhdl_FILE "../$src_dir/firfilt.vhd"
execute_flow -compile
project_close

Можно установить свойства автоматизации скрипта на фиктивные значения иллюстрировать, как кодер создает скрипт синтеза из свойств.

Спроектируйте фильтр и сгенерируйте HDL. Задайте инструмент синтеза и пользовательский текст, чтобы включать в скрипт синтеза.

lpf = fdesign.lowpass('fp,fst,ap,ast',0.45,0.55,1,60);
firfilt = design(lpf,'equiripple','FilterStructure','dfsymfir', ...
    'Systemobject',true);
generatehdl(firfilt,'InputDataType',numerictype(1,14,13), ...
    'HDLSynthTool','ISE', ...
    'HDLSynthInit','init line 1 : module name is %s\ninit line 2\n', ...
    'HDLSynthCmd','command : HDL filename is %s\n', ...
    'HDLSynthTerm','term line 1\nterm line 2\n');
### Starting VHDL code generation process for filter: firfilt
### Generating: /tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp658a2b87/hdlfilter-ex64737676/hdlsrc/firfilt.vhd
### Starting generation of firfilt VHDL entity
### Starting generation of firfilt VHDL architecture
### Successful completion of VHDL code generation process for filter: firfilt
### HDL latency is 2 samples

Кодер генерирует файл с именем скрипта firfilt_ise.tcl. Отметьте местоположения пользовательского текста, который вы задали. Можно использовать эту функцию, чтобы добавить инструкции по синтезу в сгенерированный скрипт.

type hdlsrc/firfilt_ise.tcl
init line 1 : module name is firfilt
init line 2
command : HDL filename is firfilt.vhd
term line 1
term line 2

Входные параметры

свернуть все

Отфильтруйте, от которого можно сгенерировать HDL-код в виде Системного объекта фильтра. Чтобы создать Системный объект фильтра, используйте design функционируйте или смотрите страницу с описанием объекта. Можно использовать следующие Системные объекты от DSP System Toolbox™:

Входные данные вводят в виде a numerictype объект. Этот аргумент применяется только, когда входным фильтром является Системный объект. Вызовите numerictype(s,w,f), где s 1 для со знаком и 0 для без знака, w размер слова в битах и f количество дробных битов.

Дробный тип данных задержки в виде a numerictype объект. Этот аргумент применяется только, когда входным фильтром является dsp.VariableFractionalDelay Системный объект. Вызовите numerictype(s,w,f), где s 1 для со знаком и 0 для без знака, w размер слова в битах и f количество дробных битов.

Отфильтруйте, от которого можно сгенерировать HDL-код в виде dfilt объект. Можно создать этот объект при помощи design функция. Для обзора поддерживавших функций фильтра смотрите Параметры конфигурации Фильтра.

Альтернативы

Можно использовать fdhdltool функция, чтобы сгенерировать HDL-код вместо этого (требует Filter Design HDL Coder™). Задайте вход и дробные типы данных задержки в качестве аргументов, и затем установите дополнительные свойства в диалоговом окне Generate HDL.

Смотрите также

|

Представлено до R2006a
Для просмотра документации необходимо авторизоваться на сайте