How do I make a counter count every three clock cycle like 1 after three clock cycle 2 after three clock cycle 3 and so on in xilinx matlab system generator simulink..

3 次查看(过去 30 天)
I was desiging a project where i want how I can make the counter count every three clock cycle like 1 after three clock cycle 2 after three clock cycle 3 and so on in the wave scope.

回答(1 个)

Aastha
Aastha 2024-9-5
Hi Adithya,
As I understand, you are looking to design a counter that increments every 3 clock cycles within a Xilinx System Generator Subsystem in Simulink.
The Xilinx System Generator Subsystem block allows you to model designs using blocks from both Simulink and Xilinx, and automatically generate integrated HDL code. This setup uses HDL Coder to generate HDL code from Simulink blocks and Xilinx System Generator to generate HDL code from the Xilinx System Generator Subsystem blocks. Here is the link to MathWorks documentation on how to create a Xilinx System Gererator Subsystem:
You can make a counter using two Counters and a Comparator Block in Simulink as follows:
  • The output of Comparator block is high when input is above threshold.
  • Clock signal block generates a clock signal for logic systems.
  • Counter Block counts up or down through a specified range of numbers.
  • Set the first counter to count to a maximum value of two. Connect the clock signal output to the increment input of this first counter.
  • Then, connect the output of the first counter to a comparator that checks for the value 2.
  • Finally, connect the comparator's output to the increment input of the second counter. This configuration ensures that the second counter increments every 3 clock cycles since the first counter will reach 2 after 3 clock cycles, triggering the second counter.
Once your Simulink model is ready, you may refer to the steps mentioned in the MathWorks documentation for HDL Code Generation from Simulink and using Xilinx System Generator for DSP with HDL Coder to generate the HDL code. Here is the link to the documentation:
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品


版本

R2012b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by