In the following code: First, I am loading ROM with data and weight at given address. In the same clock I am doing multiplication of data and weight. Finally, I am extending the number of bits from 16-bit to 23-bit. The code compiles without errors but has warnings. I am unable to solve these warnings.
module main_module(extended_out,mux_out,data,weight,clk,en,addr);
input clk,en;
input [2:0] addr;
output [7:0] data,weight;
output [15:0] mux_out;
output [22:0] extended_out;
ram_input a1 (clk, en, addr, data);
ram_weight a2 (clk, en, addr, weight);
top_module a3 (mux_out,data,weight);
SignExtender a4 (clk,mux_out,extended_out);
endmodule
################### MODULE 1 ########################################
module ram_input (clk, en, addr, data);
input clk;
input en;
input [2:0] addr;
output reg [7:0] data;
reg [2:0] raddr;
always @(posedge clk)
begin
if (en)
raddr <= addr;
end
always @(raddr,en)
begin
if (en)
begin
case(raddr)
3'b000: data = 8'b0000_0010;
3'b001: data = 8'b0000_0110;
3'b010: data = 8'b0000_1110;
3'b011: data = 8'b0000_0010;
3'b100: data = 8'b0000_0100;
3'b101: data = 8'b0000_1010;
3'b110: data = 8'b0000_1100;
3'b111: data = 8'b0000_0000;
default: data = 8'b0000_XXXX;
endcase
end
else
data = 8'b0000_0000;
end
endmodule
####################################### MODULE 2 ########################
module ram_weight (clk, en, addr, weight);
input clk;
input en;
input [2:0] addr;
output reg [7:0] weight;
reg [2:0] raddr;
always @(posedge clk)
begin
if (en)
raddr <= addr;
end
always @(raddr,en)
begin
if (en)
begin
case(raddr)
3'b000: weight = 8'b0000_1000;
3'b001: weight = 8'b0000_1010;
3'b010: weight = 8'b0001_1101;
3'b011: weight = 8'b0001_0100;
3'b100: weight = 8'b0000_0111;
3'b101: weight = 8'b0001_0010;
3'b110: weight = 8'b0010_1000;
3'b111: weight = 8'b0011_1111;
default: weight = 8'b0000_XXXX;
endcase
end
else
weight = 8'b0000_0000;
end
endmodule
############################33 MODULE--3 #####################
module top_module(p,x,y);
output [15:0]p;
input [7:0]x,y;
reg [15:0]p;
reg [15:0]a;
integer i;
always @(x , y)
begin
a=x;
p=0;
for(i=0;i<8;i=i+1)
begin
if(y[i])
p=p+a;
a=a<<1;
end
end
endmodule
############################## MOdule ----4 #############################
module SignExtender( clk, extend, extended );
input[15:0] extend;
input clk;
output[22:0] extended;
reg[22:0] extended;
wire [15:0] extend;
always @( posedge clk)
begin
extended[22:0] <= { {7{extend[15]}}, extend[15:0] };
end
endmodule
############################### ERROR ####################
WARNING 646 - Signal "a" is assigned but never used. This unconnected signal will be trimmed during the optimization process.
WARNING 1710 - "FF/Latch a4/extended_15" (without init value) has a constant value of 0 in block main_module. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other ""FF/Latch trimming"", FF/Latch ""a4/extended_14"" (without init value) has a constant value of 0 in block "main_module". This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch ""a4/extended_13"" (without init value) has a constant value of 0 in block ""main_module"". This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch ""a4/extended_12"" (without init value) has a constant value of 0 in block ""main_module"". This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch ""a4/extended_11"" (without init value) has a constant value of 0 in block ""main_module"". This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch ""a4/extended_10"" (without init value) has a constant value of 0 in block ""main_module"". This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch ""a4/extended_0"" (without init value) has a constant value of 0 in block ""main_module"". This FF/Latch will be trimmed during the optimization process.
warning--1 says you didn't use constant "a" variable but while doing multiplication I took as an temporary register but remaining errors I don't understand what they really going to tell...
Please help explain these warnings.