Similar Threads:
1.Dynamic function generation
Dear list,
I'm trying to dynamically generate functions; it seems that what I
really want is beyond C itself, but I'd like to be confirmed here.
In the minimal example below, I'd like to create content to put at
the address pointed to by f. In particular, I'd like to avoid/replace
the memcpy line.
Possible application (inspired by Paul Graham, "ANSI Common Lisp",
page 2): write a function that takes a number n, and returns a function
that adds n to its argument.
Any comments would be much appreciated.
Thanks,
Marco
// BEGIN CODE
#include <stdio.h>
int main(void) {
int (*f)(const char *f, ...);
int n;
f = printf;
n = sizeof(int(*)(const char *, ...));
f("Hi! My size is %d.\n", n);
f = (int(*)(const char *f, ...))malloc(n+1);
memcpy(f, printf, n+1);
if (f == (int(*)(const char*, ...))NULL)
printf("Mem full!\n");
f("Hello, World!");
free(f);
return 0;
}
// END CODE
2.[Fwd: Vhdl dynamic generation]
-------- Original Message --------
Subject: Vhdl dynamic generation
Date: Wed, 25 Jun 2003 09:22:37 -0700 (PDT)
From: silicia mando
Hello,
Besides "Generic" and "Global" variable concepts,
do you think that VHDL is suitable for "dynamic"
parametrization?
Let's take the following examples:
if implementing a conventional FIR filter with known
input range, then we can optimally pre-calculate the
minimum wordldength at each FIR node. These optimal
values should be preferably used when implementing
this filter.
However, can we set (from the same synthesiser
environment ) these wordlengths dynamically when
generating the VHDL code for this FIR for any input
range values ?.
Wondering if we can call a "function" that allows us
to undertake mathematical computation before setting
the wordlength at each node.
If not, i can think on generating a text file where
all the nodes wordlength are included. This file will
be used in setting the internal FIR wordlength?
But as i said, i am looking to work in the same
environement, without calling or running another
software
Things might seem harder if we want to generate a core
for flt2 cascaded to flt1, and i want to use solely
the same synthesiser without calling in other
language.
i expect this is not possible since most of the core
generator has front end NOT using VHDL, especially
when considering that a function call will return a
value and not a parametrised vhdl code
if i am wrong, i will be glad to have hints from you.
In summary i am wondering on the following issue:
could we have such call
VHDL_CODE=
cascade_call_function(flt1[Coef1],flt2[Coef2])
using the same synthesiser
how this code can be inserted DYNAMICALLY in other
vhdl code project?
is it better to develop a user library, so the user
can set these coefficients in the call instantiation ?
say i develop a filter with array input at the entity
this array contains the filter coefficient. so when
calling this filter i just send the appropriate
coefficients
sorry if my question is so confusing
Thanks for your time
Kind Regards
3.dynamic variables generation
Hello;
I've been going through the forums and found no satisfying answer:
I want to generate on the fly variable names such as
$myprefix_1
$myprefix_2
$myprefix_3
$myprefix_4
...
using a for construct ... how can I build and then access them in
another for construct (tryed $myprefix_$i ... not satisfying)
thanks!
4.dynamic control generation - visual tcl
hi-
i am looking for the trick to dynamically with programming code create a
control in visual tcl development environment.
i use place geometry manager. if anyone has done this and can share with me
the secret,
please respond. i'd like the control to appear in a toplevel or frame.
usually i drag and drop and use what is available
but that is not an option for what i must do now.
thank you,
marvin
5.kirby g4 g5 generation 4 generation 5 bag
6. Newbie function generation
7. Random generation in function
8. Automatic generation of function's uses and dependences (graph representation)