SharpWeapon
Member level 5
- Joined
- Mar 18, 2014
- Messages
- 89
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 705
String to STD_LOGIC_VECTOR conversion
Hi people,
I need some help. I have a text file which contains binary data(as shown below, the first row is 'a' and the second one is 'b' as for (a+bj)):
00000000 11110000
11110101 11110101
00010000 00000000
00001011 11110101
00000110 11110001
00010000 00000000
Then I read this file like this :
readData: out string(1 to 8);
dataRead: string(1 to 8);
--------------------
readline(toBeRead, inLine);
read(inLine, dataRead);
readData<=dataRead;
Now readData appears to be like this(Ex: for line 2 of the file):
'1','1','1', '1','0','1','0','1','HT','1','1','1','1','0','1','0','1'
But I want to read the file as STD_LOGIC_VECTOR(as 1111010111110101 Logic vector) not as string array.
What should I do? Or Is there a way to convert readData to one logic vector as I needed? Help is very much appreciated.
NB: I had tried to change the above code
readData: out STD_LOGIC_VECTOR(1 to 8);
dataRead: STD_LOGIC_VECTOR(1 to 8);
It has error, I think read() function can only operate on string types.
Hi people,
I need some help. I have a text file which contains binary data(as shown below, the first row is 'a' and the second one is 'b' as for (a+bj)):
00000000 11110000
11110101 11110101
00010000 00000000
00001011 11110101
00000110 11110001
00010000 00000000
Then I read this file like this :
readData: out string(1 to 8);
dataRead: string(1 to 8);
--------------------
readline(toBeRead, inLine);
read(inLine, dataRead);
readData<=dataRead;
Now readData appears to be like this(Ex: for line 2 of the file):
'1','1','1', '1','0','1','0','1','HT','1','1','1','1','0','1','0','1'
But I want to read the file as STD_LOGIC_VECTOR(as 1111010111110101 Logic vector) not as string array.
What should I do? Or Is there a way to convert readData to one logic vector as I needed? Help is very much appreciated.
NB: I had tried to change the above code
readData: out STD_LOGIC_VECTOR(1 to 8);
dataRead: STD_LOGIC_VECTOR(1 to 8);
It has error, I think read() function can only operate on string types.
Last edited: