问题描述
我正在尝试在SIMULINK中实现计数器逻辑,
I am trying to implement a counter logic in SIMULINK where
in1, in2 are inputs
out1 is the output
if in2 = 0, out1 = 0;
if in2 = 1, out1 = 1 after x high edges of in1
我尝试使用正检测上升块,但由于没有足够的经验在SIMULINK中正确实现时序图,因此失败了。有人可以请我指出正确的方向吗?
I have tried using "Detect Rise Positive" block but failed miserably because I don't have sufficient experience of implementing a timing diagram correctly in SIMULINK. Could anyone kindly point me to the right direction?
更新
一种方法自从发布此问题以来,我一直采取触发并启用子系统的问题。我正在尝试将其设置为:
An approach I have taken since I posted this question is the "Triggered and enabled subsystem". I am trying to set it up so that:
in2 becomes the enable signal
in1 becomes the trigger
in2 becomes the intput to the subsystem
Out1 becomes the output of the subsystem
的输出认为以上是垃圾。不幸的是,我不是可以使用4-5行硬件逻辑描述来实现它的VHDL。
But I think that the above was rubbish. Unfortunately it is not VHDL where I could have implemented it using 4-5 lines of description of the hardware logic.
推荐答案
在simulink中可以很容易地实现计数器逻辑。进行切换,将控制输入设为int1。如果int1为1,则输出应为0,否则请使用另一个开关将其控制输入作为int2。如果int2为1,则输出应为反馈功能延迟块中给定的1+上一个值
A counter logic can be implemented very easily in simulink. Take a switch,give the control input as int1. If int1 is 1 ur output shuld be 0 else take another switch give its control input as int2. if int2 is 1 ur output shuld be 1+ previous value given in feedback funit delay block
这篇关于在SIMULINK中实现自定义计数器逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!