ptjw
Junior Member level 3

hello all, i have with me a spartan 3 starter board that has 4 LEDs and 4 capacitive touch pads that can be interfaced with. i have an upcoming project that would use the spartan 3A FPGA and i figured this starter board would be a good place for me to start as i have no experience with FPGAs and VHDL programming.
i intended to program the FPGA to read a text file from the PC. this text file holds instructions that control which button activates which LED on the board. the contents of the text file is as shown here:
led_1 : push_A
led_2 : push_C
led_3 : push_B
led_4 : push_D
meaning button A would toggle LED1, button C would toggle LED2 and so on.
i would then check the values of the strings i collected from the textfile and assign them to their respective buttons.
i managed to read the textfile from the PC, but i have been having big problems with the ISE Project Navigator (version 12.1) as the compiler keeps cutting away the strings that i use to store the data. my code is shown here:
it works perfectly in the simulator, the respective LEDs toggle on and off whenever the buttons are toggled. but when i compile the program the followinng errors occur:
i edited the code and text file to read just one character eg 'A' 'B' 'C' instead of "push_A" "push_B" "push_C" and it is able to compile the program. what's the issue with strings here?
what is 'copy1_2_7'...'copy1_1_4'? ...etc? what does the 2_7 or 1_4 etc etc mean?
why are the strings being trimmed when there are valid values being assigned to them?
i have been assigned a more complicated project but i figured that starting small would help my overall understanding, but a simple program like this is already a stumbling block for me
i do not have enough experience in VHDL to know what is the 'correct' way of doing this and would appreciate any help, thanks!
i intended to program the FPGA to read a text file from the PC. this text file holds instructions that control which button activates which LED on the board. the contents of the text file is as shown here:
led_1 : push_A
led_2 : push_C
led_3 : push_B
led_4 : push_D
meaning button A would toggle LED1, button C would toggle LED2 and so on.
i would then check the values of the strings i collected from the textfile and assign them to their respective buttons.
i managed to read the textfile from the PC, but i have been having big problems with the ISE Project Navigator (version 12.1) as the compiler keeps cutting away the strings that i use to store the data. my code is shown here:
Code:
architecture Behavioral of switch_port is
shared variable copy1: string(6 downto 1):= " ";
shared variable copy2: string(6 downto 1):= " ";
shared variable copy3: string(6 downto 1):= " ";
shared variable copy4: string(6 downto 1):= " ";
shared variable gate : boolean := false;
file textfile : text;
begin
readprocess:
process(clock)
variable l: line;
variable s: string(14 downto 1);
variable b: boolean;
begin
if clock = '1' and clock'event then
if gate = false then --ensure that reading of file is only done once
file_open(textfile, "C:\readme.txt", READ_MODE);
readline(textfile, l);
read(l, s, b);
copy1 := s(6 downto 1); --final result is copy1 = "push_A"
readline(textfile, l);
read(l, s, b);
copy2 := s(6 downto 1); --final result is copy1 = "push_C"
readline(textfile, l);
read(l, s, b);
copy3 := s(6 downto 1); --final result is copy1 = "push_B"
readline(textfile, l);
read(l, s, b);
copy4 := s(6 downto 1); --final result is copy1 = "push_D"
file_close(textfile);
gate := true;
else --when file is already read, don't read again
if copy1 = "push_A" then
led_1 <= push_A;
elsif copy1 = "push_B" then
led_1 <= push_B;
elsif copy1 = "push_C" then
led_1 <= push_C;
else
led_1 <= push_D;
end if;
if copy2 = "push_A" then
led_2 <= push_A;
elsif copy2 = "push_B" then
led_2 <= push_B;
elsif copy2 = "push_C" then
led_2 <= push_C;
else
led_2 <= push_D;
end if;
if copy3 = "push_A" then
led_3 <= push_A;
elsif copy3 = "push_B" then
led_3 <= push_B;
elsif copy3 = "push_C" then
led_3 <= push_C;
else
led_3 <= push_D;
end if;
if copy4 = "push_A" then
led_4 <= push_A;
elsif copy4 = "push_B" then
led_4 <= push_B;
elsif copy4 = "push_C" then
led_4 <= push_C;
else
led_4 <= push_D;
end if;
end if;
end if;
end process;
end Behavioral;
it works perfectly in the simulator, the respective LEDs toggle on and off whenever the buttons are toggled. but when i compile the program the followinng errors occur:
Code:
WARNING:Xst:1710 - FF/Latch <copy1_6_0> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_1> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_2> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_3> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_4> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_5> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_6> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_6_7> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_0> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_1> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_2> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_3> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_4> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_5> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_6> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_4_7> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_0> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_1> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_2> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_3> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_4> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_5> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_6> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_5_7> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_0> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_1> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_2> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_3> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_4> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_5> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_6> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_3_7> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_0> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_1> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_2> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_3> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_4> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_5> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_6> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_1_7> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_0> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_1> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_2> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_3> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_4> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_5> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_6> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <copy1_2_7> (without init value) has a constant value of 0 in block <switch_port>. This FF/Latch will be trimmed during the optimization process.
i edited the code and text file to read just one character eg 'A' 'B' 'C' instead of "push_A" "push_B" "push_C" and it is able to compile the program. what's the issue with strings here?
what is 'copy1_2_7'...'copy1_1_4'? ...etc? what does the 2_7 or 1_4 etc etc mean?
why are the strings being trimmed when there are valid values being assigned to them?
i have been assigned a more complicated project but i figured that starting small would help my overall understanding, but a simple program like this is already a stumbling block for me