T
Tadeu
Guest
///////////////////////////////////////////////////////////////////////////////
//Logical Unit
module UnidadeLogica(a, b, s, f);
input [0:3] a,b;
input [0:1] s;
output [0:3] f;
assign f = Logica(a,b,s);
function[0:3] Logica;
input [0:3] a,b;
input [0:1] s;
case(s)
2'b00 : begin//AND
Logica = a & b;
end
2'b01 : begin//OR
Logica = a | b;
end
2'b10 : begin//XOR
Logica = a ^ b;
end
2'b11 : begin//XNOR
Logica = ~(a ^ b);
end
default: begin
Logica = 4'bz;
end
endcase
endfunction
endmodule
////////////
This works good. Now I intended to create a aritmetical unit but for
that I need a fullAdder4Bits created by me "FullAdderQuatro" then I
tried to do this:
///////////////////////////////////////////////////////////////////////////////
//Unidade Aritmética
module UnidadeAritmetica(a, b, s, cIn, cOut, f);
input [0:3] a,b;
input [0:1] s;
output [0:3] f;
input cIn;
output cOut;
wire [0:4] result;
assign result = Aritmetica(a,b,s,cIn);
assign f = result[0:3];
assign cOut = result[4];
function[0:4] Aritmetica;
input [0:3] a,b;
input [0:1] s;
input cIn;
case(s)
2'b00 : begin//transfer a to output adding cIn
FullAdderQuatro
fa4(cIn,a,4'b0000,Aritmetica[0:3],Aritmetica[4]);
end
2'b01 : begin
FullAdderQuatro fa4(cIn,a,b,Aritmetica[0:3],Aritmetica[4]);
end
default: begin
Aritmetica = 4'bz;
//$display("Operaçăo năo existe!");
end
endcase
endfunction
endmodule
//////////////
but I got this error:
and.v:145: parse error
and.v:145: error: malformed statement
and.v:148: parse error
and.v:148: error: malformed statement
where line 145 is FullAdderQuatro
fa4(cIn,a,4'b0000,Aritmetica[0:3],Aritmetica[4]);
what is the problem now?
tnkz
//Logical Unit
module UnidadeLogica(a, b, s, f);
input [0:3] a,b;
input [0:1] s;
output [0:3] f;
assign f = Logica(a,b,s);
function[0:3] Logica;
input [0:3] a,b;
input [0:1] s;
case(s)
2'b00 : begin//AND
Logica = a & b;
end
2'b01 : begin//OR
Logica = a | b;
end
2'b10 : begin//XOR
Logica = a ^ b;
end
2'b11 : begin//XNOR
Logica = ~(a ^ b);
end
default: begin
Logica = 4'bz;
end
endcase
endfunction
endmodule
////////////
This works good. Now I intended to create a aritmetical unit but for
that I need a fullAdder4Bits created by me "FullAdderQuatro" then I
tried to do this:
///////////////////////////////////////////////////////////////////////////////
//Unidade Aritmética
module UnidadeAritmetica(a, b, s, cIn, cOut, f);
input [0:3] a,b;
input [0:1] s;
output [0:3] f;
input cIn;
output cOut;
wire [0:4] result;
assign result = Aritmetica(a,b,s,cIn);
assign f = result[0:3];
assign cOut = result[4];
function[0:4] Aritmetica;
input [0:3] a,b;
input [0:1] s;
input cIn;
case(s)
2'b00 : begin//transfer a to output adding cIn
FullAdderQuatro
fa4(cIn,a,4'b0000,Aritmetica[0:3],Aritmetica[4]);
end
2'b01 : begin
FullAdderQuatro fa4(cIn,a,b,Aritmetica[0:3],Aritmetica[4]);
end
default: begin
Aritmetica = 4'bz;
//$display("Operaçăo năo existe!");
end
endcase
endfunction
endmodule
//////////////
but I got this error:
and.v:145: parse error
and.v:145: error: malformed statement
and.v:148: parse error
and.v:148: error: malformed statement
where line 145 is FullAdderQuatro
fa4(cIn,a,4'b0000,Aritmetica[0:3],Aritmetica[4]);
what is the problem now?
tnkz