473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 10295
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
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...
0
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...
3
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...
2
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,...
8
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...
71
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? ...
7
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...
5
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...
0
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.