Sunteți pe pagina 1din 5

32 Bit ADD_SUB

//////////////////////////////////////////////////////////////////////////////////
module top(
input CLK
);
wire [64:0] data;
wire [32:0] out;
wire [35:0] CONTROL;

add_sub dut (
.A(data [31:0]),
.B(data [63:32]),
.EN(data[64]),
.CLK(CLK),
.Y(out)
);
vio D_vio (
.CONTROL(CONTROL), // INOUT BUS [35:0]
.CLK(CLK), // IN
.ASYNC_OUT(data), // OUT BUS [64:0]
.SYNC_IN(out) // IN BUS [32:0]
);
icon D_icon (
.CONTROL0(CONTROL) // INOUT BUS [35:0]
);
Endmodule

//////////////////////////////////////////////////////////////////////////////////
module add_sub(
input [31:0] A,
input [31:0] B,
input EN,
input CLK,
output reg [32:0] Y
);
always @ (posedge CLK)
if (EN)
Y <= A+B;
else
Y <= A-B;

endmodule
//////////////////////////////////////////////////////////////////////////////////

#UCF
# PlanAhead Generated physical constraints
NET "CLK" LOC = C9; // Spartan 3E sys Clock

S-ar putea să vă placă și