Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

simple C++ wrapper for VHDL DFF code

Status
Not open for further replies.

milindashokshende

Newbie level 5
Newbie level 5
Joined
Jan 9, 2008
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,360
I am researching the co-simulation interface VHDL and systemC. systemC is based on C++. as a very simple model, I want to creat a C function which wrapps a VHDL DFF code. which I may use in C++ class as a function member. i want to creat stucture like this C++ Class{ (private:fucntion member(C fuction which wrapps (VHDL Code)))}; above code line does not strictly follow the syntactical formats. I would like to write a DFF testbench in C++.

I want to know, how can I write a C++ wrapper for a simple VHDL D-flip-flop code. The code can be as follows:

entity DFF is
Port ( D : in std_logic;
CLK : in std_logic := '0';
Q : out std_logic;
QN : out std_logic);
end DFF;

architecture behv of DFF is
begin

process (CLK)
begin
if CLK'event and CLK = '1' then
Q <= D;
QN <= NOT D;
end if;
end process;
end behv;
 
Last edited:

You have problems with your VHDL code. you cannot drive the input CLK from inside the entity. The idea would be to drive the clk from the systemC wrapper (or external)

Also, you have not described a DFF, you have created a latch, as it is level sensitive, not edge sensitive.
 

"You have problems with your VHDL code. you cannot drive the input CLK from inside the entity."

yes you are correct, the following line should not be there in the behavior of DFF.
clk = not clk after 5us;
clk generation can come only in test bench.

The idea would be to drive the clk from the systemC wrapper (or external)
Also, you have not described a DFF, you have created a latch, as it is level sensitive, not edge sensitive.

yes, the clk condition should be
if clk'event and clk =='1' then

but the main problem is not dff code, the main problem is to creat a wrapper for DFF in C/C++ . I don't have any experience in wrapper design.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top