Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21600 Discussions

Error: Cannot drive signal 'data' of mode IN

Altera_Forum
Honored Contributor II
4,586 Views

Hi, 

 

I am new user to ModelSim and writing VHDL code.. 

 

I've got the follwing msg when I compiled a vhdl code 

 

"Error controller.vhd(64): Cannot drive signal 'data' of mode IN." 

 

First, I want to to know where could I find a place to read about compiler error messages .. 

 

Second, I didn't understand what this error means? 

 

I have the follwing declarations in my code 

 

constant instruction_size :integer:=10; 

constant operation_size :integer:=4; 

 

subtype command_word is unsigned(operation_size-1 downto 0); 

subtype program_word is unsigned(instruction_size-1 downto 0); 

 

data : in program_word; -- in the entity of the controller 

 

--the follwing in the structure of the controller 

alias command: command_word is data (instruction_size-1 downto 6); 

signal instr : program_word ; 

 

type state_type is (S0, S1, S2, S3, S4, S5, S6, S7, S8); 

signal state: state_type; 

 

Then I have this piece of code  

 

case state is 

when S2 => instr<=data; -- Load instruction 

state <= S3;  

 

when S3 => command <= instr (instruction_size-1 downto 6);  

 

when I compile this file I got the above mentioned error msg on the last line of code above, i.e " when S3 => ...." 

 

I am looking forward to get some help with this problem.. 

 

Thank you in advance
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
3,299 Views

If I understand right, you are trying to assign a value to a port signal of IN type. This isn't possible by basic VHDL rules - and can't create a meaningful logic behaviour, to my opinion. A signal can either be driven externally or from internal logic. If the signal source is intended to be changed during operation, a multiplexer would be necessary.

0 Kudos
Altera_Forum
Honored Contributor II
3,299 Views

Thank you Fvm for your answer, 

I discovered that I had missunderstod how to use aliased signals. 

I corrected it and all the things are ok now. 

 

Regards
0 Kudos
Reply