Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Errors about invalid MSB and LSB in Verilog function

Status
Not open for further replies.

neerajgoyal

Newbie level 3
Joined
Oct 25, 2006
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
I have following function in my verilog module. I am getting error that invalid MSB and LSB for first_image_final and second_image_final.

Please help me out

function [7:0] difference;
input [20479:0] first_image_final;
input [20479:0] second_image_final;
input control_second_image;
input control_second_signal;
input control_first_signal;
reg [7:0] temp_difference;
integer i,j,k;

begin
for(j=0; j< window * window; j=j+8)
begin
for(i=0; i< window * window; i=i+8)
begin
temp_difference [7:0] = temp_difference [7:0] + (first_image_final [i+j+k+control_first_signal+7:i+j+k+control_first_signal] - second_image_final [i+j+k+control_second_signal+7:i+j+k+control_second_image]);
end
k = k + 5120;
end
difference [control_second_signal+7:control_second_signal] = temp_difference [7:0];
end

endfunction
 

Re: function in verilog

This is the problem!
difference [control_second_signal+7:control_second_signal] = temp_difference [7:0];

difference is defined as [7:0]
What ur trying to do is shift the return value as per input parameter.
Other problem is k is not initialize!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top