top.v 446 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
module top (
	input clock,
	input [31:0] dinA, dinB,
	input [2:0] opcode,
	output reg [31:0] dout
);
	always @(posedge clock) begin
		case (opcode)
		0: dout <= dinA + dinB;
		1: dout <= dinA - dinB;
		2: dout <= dinA >> dinB;
		3: dout <= $signed(dinA) >>> dinB;
		4: dout <= dinA << dinB;
		5: dout <= dinA & dinB;
		6: dout <= dinA | dinB;
16
`ifndef BUG
17
		7: dout <= dinA ^ dinB;
18 19 20
`else
		7: dout <= -dinA ^ dinB;
`endif
21 22 23
		endcase
	end
endmodule