First of all, i recommend you when you design a finite state machine in vhdl use next state logic approach for all regiters. VHDL is not a programming language like C or basic. Read the books of Stephen Brown or Pong Chu to understand the method.
Some signals has no a default value. This is the cause of the error:
states: process(pstate,data,trigger)
begin
i_next <= i_reg; -- default value
data_next <= reg; -- default value
.... -- and this for all registers
case pstate is
when start =>
i_next <= to_unsigned(24,5);
data_next <= data;
nstate <...
The other things is the name and purpose of signals are bit confused. I give a suggestion:
entity control_unit2 IS
port(
reset : in std_logic;
clk : in std_logic;
trigger: in std_logic;
data : in std_logic_vector (23 downto 0);
data_out : out std_logic;
clk_out : out std_logic
);
end control_unit2;
Architecture Behavioral of control_unit2 is
type state_type is (start, load, pulse, rst, shift, check, hold);
signal pstate, nstate : state_type;
signal data_reg, data_next : std_logic_vector (23 downto 0);
signal i_reg, i_next : unsigned (4 downto 0);
signal datout_reg, datout_next: std_logic ;
signal clkout_reg, clkout_next: std_logic;
BEGIN
clocked: PROCESS (clk)
BEGIN
if( reset = '1' ) then
pstate <= start;
i_reg <= ( others => '0' );
data_reg <= ( others => '0' );
datout_reg <= '0';
clkout_reg <= '0';
elsif clk'event and clk = '1' then
pstate <= nstate;
i_reg <= i_next;
data_reg <= data_next;
datout_reg <= datout_next;
clkout_reg <= clkout_next;
END IF;
END PROCESS clocked;
states: process(pstate,data,trigger) -- complete de sensitivity list
begin
data_next <= data_reg;
i_next <= i_reg;
clkout_next <= clkout_reg;
datout_reg <= datout_next;
case pstate is
when start =>
i_next <= to_unsigned(24,5);
data_next <= data;
nstate <= load;
clk_next <= '0';
when load =>
datout_next <= data_reg(23);
nstate <= pulse;
clk_next <= '0';
i_next <= i_reg;
when pulse =>
data_next <= data_reg(22 downto 0) & '0';
clkout_next <= '1';
nstate <= rst;
i_next <= i_reg;
when rst =>
i_next <= i_reg;
clkout_next <= '0';
nstate <= shift;
when shift =>
i_next <= i_reg - 1;
nstate <= check;
when check =>
if i_reg = 0 then
nstate <= hold;
else
nstate <= load;
end if;
when hold =>
nstate <= hold;
-- GENERATE a 1 CLOCK PULSE SIGNAL IN '1' TO TELL OTHER CIRCUIT THAT
-- YOU FINISH THE TRANSMISSION. THEN RETURN TO START STATE TO
-- WAIT ANOTHER TRIGGER
end case;
end process states;
clk_out <= clkout_reg;
data_out <= datout_reg;
END Behavioral;
I hope this fix the errors.