-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardware.v
110 lines (91 loc) · 1.8 KB
/
hardware.v
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
module hw_h0(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {4'b0000, ip_x}; //h0 = 1
end
endmodule
module hw_h1(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {3'b000, ip_x, 1'b0}; //h1 = 2
end
endmodule
module hw_h2(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {3'b000, ip_x, 1'b0} + {4'b0000, ip_x}; //h2 = 3
end
endmodule
module hw_h3(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {2'b00, ip_x, 2'b00}; //h3 = 4
end
endmodule
module hw_h4(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {2'b00, ip_x, 2'b00} + {4'b0000, ip_x}; //h4 = 5
end
endmodule
module hw_h5(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {2'b00, ip_x, 2'b00} + {3'b000, ip_x, 1'b0}; //h5 = 6
end
endmodule
module hw_h6(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {2'b00, ip_x, 2'b00} + {3'b000, ip_x, 1'b0} +
{4'b0000, ip_x}; //h6 = 7
end
endmodule
module hw_h7(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {1'b0, ip_x, 3'b000}; //h7 = 8
end
endmodule
module hw_h8(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= {1'b0, ip_x, 3'b000} + {4'b0000, ip_x}; //h8 = 9
end
endmodule
module hw_h9(
input wire [3:0] ip_x,
output reg [7:0] op_y,
input wire clk
);
always @(posedge clk) begin
op_y <= ({1'b0, ip_x, 3'b000} + {3'b000, ip_x, 1'b0}) ; //h9 = 10
end
endmodule