Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > doubt in FLI Program and order of execution

Reply
Thread Tools

doubt in FLI Program and order of execution

 
 
priya
Guest
Posts: n/a
 
      10-03-2005
Hi all,

I have written simple 2-input and gate vhdl code.I am passing
2-input from FLI to VHDL Code and also sending VHDL Andgate output to
FLI.I am using modelsim to executed my code

Here i am pasting both VHDL and FLI CODE.



VHDL CODE:


entity and4 is
port ( in1, in2 : in bit;
out1 : out bit
);
end;
architecture only of and4 is
attribute foreign : string;
attribute foreign of only :architecture is "and_gate_init ./gates.dll";


begin
out1<=in1 and in2;
end;


-----------------------------------------
entity and_output is
port ( out1: in bit;
out2 : out bit
);
end;
architecture out_arch of and_output is
attribute foreign : string;
attribute foreign of out_arch :architecture is "and_gate_init_output
../gates.dll";

begin
end;


-- -- -- -----------------------
entity testbench is
end testbench;
architecture and_arch of testbench is
component and4
port ( in1, in2 : in bit;
out1 : out bit
);
end component;
component and_output
port ( out1: in bit;
out2: out bit
);
end component;

signal in1 : bit;
signal in2 : bit;
signal out1 : bit;
signal out2 : bit;
begin
t1 : and4 port map ( in1, in2, out1 );
t2 : and_output port map ( out1,out2);
end and_arch ;




VHDL-FLI CODE


#include <stdio.h>
#include "mti.h"

typedef struct {
mtiSignalIdT in1;
mtiSignalIdT in2;
mtiSignalIdT out1;
mtiSignalIdT out2;
} inst_rec;





void do_and( void * param )
{
inst_rec * ip = (inst_rec *)param;
mtiInt32T val1, val2,val3;
mtiInt32T result;

mti_SetSignalValue( ip->in1,1);
mti_SetSignalValue( ip->in2,1);

}



void and_gate_init(

mtiRegionIdT region,
char *param,
mtiInterfaceListT *generics,
mtiInterfaceListT *ports
)
{
inst_rec *ip;
mtiSignalIdT outp;
mtiProcessIdT proc;

mti_PrintFormatted("hello FLI Code\n");

ip = (inst_rec *)mti_Malloc( sizeof(inst_rec) );
ip->in1 = mti_FindPort( ports, "in1" );
ip->in2 = mti_FindPort( ports, "in2" );

proc = mti_CreateProcess( "p1", do_and, ip );

}

void do_and1( void * param )
{
inst_rec * ip = (inst_rec *)param;
mtiInt32T val1, val2;
mtiInt32T result;

val1 = mti_GetSignalValue( ip->out1 );


mti_PrintFormatted("variable values out1 is %d\n",val1);


}

void and_gate_init_output(
mtiRegionIdT region,
char *param,
mtiInterfaceListT *generics,
mtiInterfaceListT *ports
)
{
inst_rec *ip;
mtiSignalIdT outp;
mtiProcessIdT proc;

ip = (inst_rec *)mti_Malloc( sizeof(inst_rec) );

ip->out2= mti_FindPort( ports, "out2" );
ip->out1= mti_FindPort( ports, "out1" );

proc = mti_CreateProcess( "p1", do_and1, ip );

}



question No :1



t1 : and4 port map ( in1, in2, out1 );

This module instantions is used to get the 2-input value from fli code
by calling foreign attribute.

Here I am able to get the 2-input.But I have one doubt.

here
void and_gate_init( ---this method is in FLI CODE.


attribute foreign of only :architecture is "and_gate_init ./gates.dll";
---this line is in VHDL CODe...

Here i am calling and_gate_init foreign method only one times.but
here the and_gate_init method will be executed two times.

for ex I added printf statement in and_gate_init method...

I got the following output


hello FLI Code
hello FLI Code

it printed 2 times...
I dont know the how they method called two times.


question No.2: output foreign attribute also called two times...



2.


begin
t1 : and4 port map ( in1, in2, out1 );
t2 : and_output port map ( out1,out2);
end and_arch ;



Here I have one more doubt..How these two module instantaions
executed..It means that it Executed parallely or sequentially?

As far as my knowleage it executed Parallely....

but here i want to send the out1 value to input of the second module...

How it is possible? need to add any delay?


plz anyone reply my question.if u are not clear my question ,plz let me
know....I will explain in detail.....


can we mix structual and data flow statement in single begin and
module?



rdgs
priya

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dotnet doubt can any body clarify my doubt challa462@gmail.com ASP .Net 0 08-22-2012 06:02 AM
Equivalent of SystemVerilog DPI-C for VHDL FLI tkvhdl@gmail.com VHDL 2 04-30-2010 06:54 AM
private data stashed in local/global execution context of PyEval_EvalCode disappears down the execution stack sndive@gmail.com Python 9 11-14-2007 10:31 PM
doubt about doubt Bob Nelson C Programming 11 07-30-2006 08:17 PM
order of execution of page_load in a base and derived classes Ignacio Machin \( .NET/ C# MVP \) ASP .Net 13 09-02-2004 01:59 PM



Advertisments