[SOLVED] Unknown type Xilinx error

Status
Not open for further replies.

madalin1990

Full Member level 2
Joined
Apr 4, 2012
Messages
124
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Visit site
Activity points
2,090
Hi! I have defined a register with serial input and a paralel output. Problem is that when i'm compiling i receive the following errors. Any idea why?

ERROR:HDLCompiler:806 - "C:\Users\agrancea\Desktop\licenta\iir\sp.v" Line 23: Syntax error near "<=".
ERROR:HDLCompiler:44 - "C:\Users\agrancea\Desktop\licenta\iir\sp.v" Line 21: int_cnt is not a constant
ERROR:HDLCompiler:1059 - "C:\Users\agrancea\Desktop\licenta\iir\sp.v" Line 23: data_out is an unknown type
ERROR:HDLCompiler:1059 - "C:\Users\agrancea\Desktop\licenta\iir\sp.v" Line 24: int_cnt is an unknown type

Here's the code:
Code:
module sp(rst, clk, data_in, data_out);
  
	input rst, clk, data_in;
	output reg[7:0] data_out;

	reg [13:0] int_reg;
	reg [3:0] int_cnt;
	
	always @(negedge clk or negedge rst)
			if(rst==0)
				begin
				data_out <= 8'b0;
				int_cnt <= 4'b0;
				end
			else
				begin
				int_cnt <= int_cnt+1;
				int_reg[int_cnt] <= data_in;
				end
			if(int_cnt == 4'b1101) // se reseteaza numaratorul la 13
				begin
				data_out <= int_reg[7:0];
				int_cnt <= 4'b0;		
				end
	
endmodul
 

you have:
Code:
  always @(/.../)
    if
    
    else
    
    if

should be [depends on your intention]

Code:
  always @(/.../)
   begin
     if
    
     else
    
     if
   end
   
// --- or

  always @(/.../)
    if
    
    else if
    
    else


j.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…