473,748 Members | 5,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rising Edge D flip Flop code in c++

as
Hi folks,
am a newbie in C++ world. Normally I use matlab more often. But right
now I want to create a Rising Edge
D Flip-Flop model which has two Digital inputs, i.e. INPUTDATA and a
CLOCK. The functionality of Rising Edge D Flip Flop is that whenever a
rising edge of CLOCK signal will occur ( Rising Edge : 0 to 1 ) the
output will be the similar state of INPUTDATA signal, otherwise (if it
will be not a rising edge and CLOCK signal is 0 or 1) then the present
output will be the Previous state of the output.
I am facing the problem in case of accessing the previous values.
If you people have any suggestion please let me know.
Thanks in advance,
Cheers,
Joydeep.

Aug 24 '07 #1
2 10325
as wrote:
Hi folks,
am a newbie in C++ world. Normally I use matlab more often. But right
now I want to create a Rising Edge
D Flip-Flop model which has two Digital inputs, i.e. INPUTDATA and a
CLOCK. The functionality of Rising Edge D Flip Flop is that whenever a
rising edge of CLOCK signal will occur ( Rising Edge : 0 to 1 ) the
output will be the similar state of INPUTDATA signal, otherwise (if it
will be not a rising edge and CLOCK signal is 0 or 1) then the present
output will be the Previous state of the output.
I am facing the problem in case of accessing the previous values.
IMO the problem is not that hard to solve. Everything is clear how it
should work
If you people have any suggestion please let me know.
1) start coding
2) test your code
3) brush your teeth after every meal

Aug 24 '07 #2
On 2007-08-24 11:12, as wrote:
Hi folks,
am a newbie in C++ world. Normally I use matlab more often. But right
now I want to create a Rising Edge
D Flip-Flop model which has two Digital inputs, i.e. INPUTDATA and a
CLOCK. The functionality of Rising Edge D Flip Flop is that whenever a
rising edge of CLOCK signal will occur ( Rising Edge : 0 to 1 ) the
output will be the similar state of INPUTDATA signal, otherwise (if it
will be not a rising edge and CLOCK signal is 0 or 1) then the present
output will be the Previous state of the output.
I am facing the problem in case of accessing the previous values.
If you people have any suggestion please let me know.

You need a class to represent the flip-flip, you need to keep track of
three things, the current state of the flip-flip, the current state of
the input data, and the current clock state. Three bool variables will do.

Then you need a method the tell the flip-flip that the input data has
changed, it should look something like this

void setInput(bool input)

and a method to signal a change in the clock

void clock(bool clock)

and lastly some way to read the state from the flip-flop

bool getState()

The magic should happen in the clock() method, in there you check if the
clock-state is changed since the last call of clock(), and if it is,
check if the state changed from 0 to 1, in which case the state of the
flip-flop should be set to the state of the input.

--
Erik Wikström
Aug 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2157
by: Morgan Leppink | last post by:
Hi all - We have been developing a complex TCP socket communication app that is responsible for keeping numerous connections open to clients on routable IPs. The app receives request on a non-routable listener socket that marshals communications between the non-routable netowrk and the clients out on the routable network. The app runs as a .NET service in Win2K Server. Async
0
1544
by: Ferdi Smit | last post by:
I wrote a generic algorithm for boost.graph to merge two vertices, ie. the end-points of an edge are joined together as if they are a single vertex. I'm currently doing this by creating a new vertex, and creating an edge to this new vertex from every incident vertex of any of the end-points (and then deleting the end points and every incident edge). The problem with this approach is that edge properties are not maintained. The newly added...
3
1714
by: Saeid | last post by:
Hello the web site is working fine on localhost, but after deployment, no button is rising postback event but it's check for validation when I used IE. But when I test using FireFox agent every thing run fine. Anybody have any idea about this!!!
2
3853
by: copyco | last post by:
Does anyone have any suggestions on this? I have a form that can be collapsed into a compact size and expanded back to full size. If the user moves the compact size of the form close to the edge, then when it is brought to full size, the right edge goes off the edge of the screen. How can I code to adjust for this? If I code for checking for the left edge and the size and being a certain distance from the right edge of the screen, then...
8
6761
by: coolindienc | last post by:
At first I had no idea where to start. Finally I tried to get somewhere and I am still stuck. I wrote two different ways using while loop and for loop. Below are codes for both. I am getting errors different places for each loop. For this code I am getting error at "else" statement. import random heads = tails = count = 0 while count <= 100: flip = random.randrange(2) if flip == 0: heads += 1
71
4853
by: Murray R. Van Luyn | last post by:
Hi, Since I have made changes to my website it's been a complete flop. According to the logs, as soon as visitors have downloaded the index page they are off. I can't figure out why? http://www.review-a-gadget.com/ Is there anything obvious that I am missing? Are there problems with some browsers? Please let me know if you notice anything.
7
2805
by: kumana1 | last post by:
Here's my dilema: My database is built around people and their contact info. On my "data entry form" there is a place for their main address, and on the subform which is attached to the main form, is a place for the person's home address. I have a checkbox on the main form which I want to use to swap/flip-flop the home address with the main address. The concept I have figured out for the most part, but the code is the actual problem. ...
5
9207
TMS
by: TMS | last post by:
I'm writing a couple of classes one for a D Flip Flop and one for a JK Flip Flop in C++. The D Flip Flop seems to be working fine, but I'm having issues with the JK Flip Flop. I'm getting garbage for the variables when passing from one function to the next. Here is my code for the JK Flip Flop header, class and test: #ifndef JKflipFlop_h #define JKflipFlop_h #include <iostream> class JKFlipFlop { public:
0
4921
by: moon123 | last post by:
constructing a edge detector using sobel kernels with a discrete convolution algorithm. The result should give a vertical edge image, a horizontal edge image and a gradient image. Sobel kernels :
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.