Rising Edge D flip Flop code in c++



 DEVELOP > c-Plus-Plus > Rising Edge D flip Flop code in c++

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "as"
Date: 24 Aug 2007 04:12:43 AM
Object: Rising Edge D flip Flop code in c++
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.
.

User: "=?ISO-8859-1?Q?Erik_Wikstr=F6m?="

Title: Re: Rising Edge D flip Flop code in c++ 24 Aug 2007 06:07:55 AM
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
.

User: "anon"

Title: Re: Rising Edge D flip Flop code in c++ 24 Aug 2007 04:44:50 AM
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
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER