Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Need help with VHDL code

Status
Not open for further replies.

rg350dxlover

Member level 1
Joined
Jul 15, 2008
Messages
35
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Malaysia
Activity points
1,566
Hi everyone. I've been trying to fix this code but failed. Can anyone tell me what's wrong with it?
Also, what does this mean? What's the relation between them?
Code:
buf(serial_count) := serial_in_port;

Code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity MetroLRT is
port(
clk: in bit;
rst: in bit;
task: in bit_vector(1 downto 0);
stationed: in bit_vector(3 downto 0);
timeSTP: in bit;
serial_in_port: buffer std_logic;
serial_out_port: out bit;
gate_open_out: out bit
);
end MetroLRT;

architecture rtl of MetroLRT is
--signal
signal header1: std_logic_vector(3 downto 0);
signal balance1: std_logic_vector(6 downto 0);
signal t_stamp1: std_logic;
signal card_in1: std_logic_vector(15 downto 0);
signal station1: std_logic_vector(3 downto 0);
signal serial_count: bit;
signal buf: bit;

begin
process(clk, serial_in_port)
--variable
begin	
	if rst = '0' then
		serial_in_port <= '0';
	elsif 
		clk'event and clk = '1' then
			if	serial_in_port <= '1' then
				buf(serial_count) := serial_in_port;
				--store card info to all temporary variables
				card_in1 <= "0000000000000000";
				header1 <= "1010";
				t_stamp1 <= '1';
				station1 <= "0000";
			end if;
	end if;
end process;

enter_station: process(task)
begin
	if task = "00" then
		if header1 = "1010" then
			if balance1 >= "0001000" then
				if t_stamp1 = '1' then
					card_in1 <= "0000000";
					station1 <= "0000";
					gate_open_out <= '1';
				else
					card_in1 <= null;
					station1 <= null;
					gate_open_out <= '0';
				end if;
			end if;
		end if;
	end if;
end process;
end rtl;

Thankssss!!!!
 

buf is declared as a bit, and a signal, and serial_in_port is a std_logic (3 errors on 1 line).

So buf(serial_count) is illegal because it is not an array
and <= assignment is needed because its a signal.
and make buf a std_logic to make the types match!
 

thanks TrickyDicky. I've fixed the assignment and types.

So buf(serial_count) is illegal because it is not an array
So are you saying that buf(serial_count) should be an array?
 

only if you need it to be.
You are also missing rst from the first process sensitivity list and and header1, balance1 and t_stamp from the 2nd process.
 

You are also missing rst from the first process sensitivity list and and header1, balance1 and t_stamp from the 2nd process.

Thanks for reminding. But I read somewhere that it is not a must to include the sensitivity list, is it?
 

you need the sensitivity list for simulation, or it wont behave like the real hardware. The synthesiser ignores the sensitivity list.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top