summaryrefslogtreecommitdiff
path: root/src/rtl/modexps6_adder64_carry32.v
blob: 87869d1a6615992f8d1bad5d0b3da06aa536eaa1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
`timescale 1ns / 1ps

module modexps6_adder64_carry32
	(
		clk, t, x, y, s, c_in, c_out
	);
	
	
		//
		// Ports
		//
	input		wire				clk;
	input		wire	[31: 0]	t;
	input		wire	[31: 0]	x;
	input		wire	[31: 0]	y;
	output	wire	[31: 0]	s;
	input		wire	[31: 0]	c_in;
	output	wire	[31: 0]	c_out;
	
	
		//
		// Multiplier
		//
	wire	[63: 0]	multiplier_out;
	
	multiplier_s6 dsp_multiplier
	(
		.clk	(clk),
		.a		(x),
		.b		(y),
		.p		(multiplier_out)
	);
	
	
		//
		// Carry and T
		//
	wire	[63: 0]	t_ext = {{32{1'b0}}, t};
	wire	[63: 0]	c_ext = {{32{1'b0}}, c_in};
	
	
		//
		// Sum
		//
	wire	[63: 0]	sum = multiplier_out + c_in + t;
		
		
		//
		// Output
		//
	assign s = sum[31: 0];
	assign c_out = sum[63:32];
		
	/*
	reg	[31: 0]	s_reg;
	reg	[31: 0]	c_out_reg;
	
	assign s = s_reg;
	assign c_out = c_out_reg;
	
	always @(posedge clk) begin
		//
		s_reg			<= sum[31: 0];
		c_out_reg	<= sum[63:32];
		//
	end
	*/
	
	
endmodule