syedshan
Advanced Member level 1
- Joined
- Feb 27, 2012
- Messages
- 463
- Helped
- 27
- Reputation
- 54
- Reaction score
- 26
- Trophy points
- 1,308
- Location
- Jeonju, South Korea
- Activity points
- 5,134
Hi all
Few days back I posted my message over file reading for VHDL testbenches.
At that time I was beginner in typing testbenches in VHDL. Hence tried to learn with implmentation.
Now I have some confusions(and big ones) with string data types...
At that time, TrickyDicky helped me understanding things related to string...and as we know that in order to declare string we should fill all the locations of the signal or variable, unlike C or C++. But I don't want this, I want the function like C/C++
i.e.
Hence I looked and found something about "line" type which is like a pointer to STRING.
I have gathered info about it but cannot implement it to any purpose of mine although I tried...
How can we use LINE type as the pointer, as we use to deal in C, i.e. take part of pointer etc.
VHDL code
bests
shan
Few days back I posted my message over file reading for VHDL testbenches.
At that time I was beginner in typing testbenches in VHDL. Hence tried to learn with implmentation.
Now I have some confusions(and big ones) with string data types...
At that time, TrickyDicky helped me understanding things related to string...and as we know that in order to declare string we should fill all the locations of the signal or variable, unlike C or C++. But I don't want this, I want the function like C/C++
i.e.
Code:
variable str : string (1 to 10) := "Hello!"; --This should be valid, although it is not,
Hence I looked and found something about "line" type which is like a pointer to STRING.
I have gathered info about it but cannot implement it to any purpose of mine although I tried...
How can we use LINE type as the pointer, as we use to deal in C, i.e. take part of pointer etc.
Code:
--C code: i am talking about concept only, not exactly remember the syntax in C, now
char *name := "edaboard";
char k = name[3]; --hence k= b;
char m[3] = *(name + 4);
VHDL code
Code:
signal str : string(1 to 8) := "edaboard";
process
variable my_line : line;
begin
wait for 10 ns;
write(my_line, str & " forum"); -- my_line has "edaboard forum"
writeline(output, my_line); --displays on screen
report(my_line.all); --error
--I read about my_line.all will return string. then why not it prints
bests
shan