Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

Ones counter using numeric_std inside process

Altera_Forum
Honored Contributor II
2,066 Views

 

 

 

 

 

I had an error while working on ones counter inside the process. I use numeric_std library. Here is the key part of the code. 

 

signal one_buf:unsigned(7downto0); 

signal out_buf:std_logic_vector(7downto0); 

counter_one:process(out_buf1) 

variable one_buf1 :unsigned(7downto0):=(others=>'0'); 

begin 

for i in 0 to 7 loop 

one_buf1 := one_buf1 +unsigned(out_buf(i)); 

endloop;  

one_buf <= one_buf1; 

end process counter_one; 

 

The error message is Error(10305) cannot convert type "std_ulogic" to type "UNSIGNED". I do not understand what is wrong here. 

Thanks in advance for the answers. 

 

 

 

0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,136 Views

out_buf1(i) is a single bit. You need to make it into an array. something like: 

 

 

one_buf1 := one_buf1 + ("" & out_buf(i));
0 Kudos
Altera_Forum
Honored Contributor II
1,136 Views

 

--- Quote Start ---  

out_buf1(i) is a single bit. You need to make it into an array. something like: 

 

 

one_buf1 := one_buf1 + ("" & out_buf(i)); 

--- Quote End ---  

 

 

 

Thanks for the answer, Tricky. 

 

I tried and then there are some other errors.  

 

Error (10327): VHDL error at mess_extractor.vhd(278): can't determine definition of operator ""&"" -- found 4 possible definitions 

Error (10647): VHDL type inferencing error at mess_extractor.vhd(278): type of expression is ambiguous - "std_ulogic_vector" or "std_logic_vector" are two possible matches 

 

Can you comment on this too? Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
1,136 Views

try this: 

 

one_buf1 := one_buf1 + unsigned'("" & out_buf(i))
0 Kudos
Reply