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

Multiple constant drivers error?

Altera_Forum
Honored Contributor II
1,669 Views

Hi there, 

The problem is that my project is running perfectly on ModelSim but when I've tried to compile it on Quartus 8.1 it gave me multiple constant drivers error. 

 

Here is part of the code in verilog: 

wire ob_write = (out_buffer_write == 2'b10); always @(posedge clk) if(SCK_risingedge) cs <= ~SSEL; .... always @(posedge clk ) begin if (ob_write) byte_data_sent <= ram_data_out; end always @(posedge clk) out_buffer_write <= {out_buffer_write, (com_read_enable | com_set_enable)}; always @(posedge clk) begin if (~cs) byte_data_sent <= 8'h00; .... The error is: Error (10028): Can't resolve multiple constant drivers for net "byte_data_sent[7]" at spi.v(124) 

 

Any suggestions?  

Thanks in advance :)
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
417 Views

Hi, 

 

For every signal you must assign within one process only or one comb construct if it is not sequential. Inside the single process you will have multiple assignments for the signal. The compiler decides the logic to drive it then. 

 

If then it encounters another drive concurrently then it gets lost...
0 Kudos
Altera_Forum
Honored Contributor II
417 Views

Restating what Kaz said, make assignments to byte_data_sent in only one always block. In the code you showed, you made assignments to byte_data_sent in at least two always blocks.

0 Kudos
Altera_Forum
Honored Contributor II
417 Views

always @(posedge clk ) begin 

if (ob_write) 

byte_data_sent <= ram_data_out; 

[/INDENT] else if (~cs) 

byte_data_sent <= 8'h00; 

[/INDENT] end 

.... 

 

Were you trying to do something like this ?
0 Kudos
Altera_Forum
Honored Contributor II
417 Views

I've read some articles about clock synchronization and domain crossing and solved my problems. Thank you for giving me the direction.

0 Kudos
Reply