particleynamics
Newbie level 5
- Joined
- Feb 7, 2012
- Messages
- 10
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,347
reg signed [31:0] result;
reg signed [31:0] operand1;
reg [15:0] operand2;
always [...] begin
...
result = operand1 + operand2;
...
end
C = $signed(A)
module top;
reg signed [31:0] operand1;
reg [15:0] operand2;
reg signed [31:0] result;
initial begin
operand1 = -1;
operand2 = 10;
result = operand1 + operand2;
$display(result,,operand1,, operand2);
end
endmodule
# 9 -1 10
module adder(
input wire signed [31:0] operand1,
input wire [15:0] operand2,
output reg signed [31:0] result
);
always @(operand1 or operand2)
result = operand1 + operand2;
endmodule
module top;
reg signed [31:0] op1;
reg [15:0] op2;
wire signed [31:0] result;
adder a1(op1,op2,result);
initial begin
op1 = -1;
op2 = 10;
#10
$display(result,,op1,,op2);
end
endmodule
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?