Skip to content

Commit 55715ec

Browse files
committed
Updated Source Clarity
- Improved source code for clarity for various projects
1 parent e4b998b commit 55715ec

File tree

18 files changed

+84
-83
lines changed

18 files changed

+84
-83
lines changed

Project 1 – Introduction to Xilinx/half_adder.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// Input & Output components to use in the half-adder
1313
module half_adder
1414
(
15-
input iA, input iB,
16-
output oSUM, output oCARRY
15+
input iA, input iB,
16+
output oSUM, output oCARRY
1717
);
1818

1919
// This uses an exclusive OR gate to find the SUM of two inputs

Project 2 – Combinational Logic/dec_4_to_16/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Objective
44

5-
This 4-to-16 decoder takes one four bit input and outputs the sixteen bit representation of the input. This module uses the concept of one-hot decoding where each output would have one output that would correspond to the input.
5+
This 4-to-16 decoder takes one 4-bit input and outputs a 16-bit representation of the input. This module uses the concept of one-hot decoding where each output would have one output that would correspond to the input.
66

7-
An application for this decoder would be to convert a four bit binary to its hexadecimal representation.
7+
An application for this decoder would be to convert a 4-bit binary value to its hexadecimal representation.
88

9-
To verify this module, the input’s binary bits were converted into their decimal representation and compared to the output’s decimal representation to see if they matched.
9+
To verify this module, the binary bits of the input is converted into their decimal representation and compared to the output’s decimal representation to see if they match.
1010

1111
## Waveforms
1212

Project 2 – Combinational Logic/dec_4_to_16/dec_4_to_16_test.v

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module dec_4_to_16_test;
2323
// Instantiate the Unit Under Test (UUT)
2424
dec_4_to_16 uut
2525
(
26-
.ADDR(ADDR),
27-
.DEC(DEC)
26+
.ADDR(ADDR),
27+
.DEC(DEC)
2828
);
2929

3030
initial begin
@@ -39,7 +39,6 @@ module dec_4_to_16_test;
3939
for (count = 1; count <= 16; count = count + 1) begin
4040
#5 ADDR = count;
4141
end
42-
4342
end
4443
// The test will run for a total interval of 80ns
4544
initial #80 $finish;

Project 2 – Combinational Logic/four_bit_look_ahead_adder/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Objective
44

5-
This 4-bit look ahead adder is an improved implementation of a 4-bit ripple adder by eliminating the propagation delay found in the ripple 4-bit adder. For each output, this implementation computes each previous carry simultaneously instead of waiting for the previous adder block to yield a carry. In this adder, the first carry bit is set to zero and simplified the logic because there was no initial carry bit as the input. While this implementation uses more gates and more complex logic to accomplish the same task as the ripple adder, this implementation would add two 4-bit numbers faster than the ripple version.
5+
This 4-bit look ahead adder is an improved implementation of a 4-bit ripple adder by eliminating the propagation delay found in the 4-bit ripple adder. For each output, this implementation computes each previous carry simultaneously instead of waiting for the previous adder module to yield a carry. In this adder, the first carry bit is set to zero and simplifies the logic because there is no initial carry bit as the input. While this implementation uses more gates and more complex logic to accomplish the same task as the ripple adder, this implementation would add two 4-bit numbers much faster than the 4-bit ripple adder.
66

77
## Waveforms
88

Project 2 – Combinational Logic/four_bit_look_ahead_adder/four_bit_adder_EC_test.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ module four_bit_adder_EC_test;
3131

3232
initial begin
3333

34-
// Initialize Inputs
35-
A = 0;
36-
B = 0;
37-
count = 0;
34+
// Initialize Inputs
35+
A = 0;
36+
B = 0;
37+
count = 0;
38+
3839
end
3940

4041
//Whenever the value of either A or B changes, iterate the possible combinations
4142
always @(A or B)
4243
begin
43-
4444
// Loops over the possible combinations for A and B
4545
for (count = 0; count < 256; count = count + 1)
46-
#1 {A, B} = count;
46+
#1 {A, B} = count;
4747
#2 $stop;
4848
end
4949
endmodule

Project 2 – Combinational Logic/four_bit_ripple_adder/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Objective
44

5-
This 4-bit adder takes advantage of the full adder module by taking four full adders and linking them together to add 2 four bit inputs. In the 4-bit adder, the first carry bit is set to zero because there was no initial carry bit as the input.
5+
This 4-bit adder takes advantage of the full adder module by taking four full adders and linking them together to add 2 four bit inputs. In the 4-bit adder, the first carry bit is set to zero because there is no initial carry bit as an input.
6+
67

78
## Waveforms
89

@@ -12,4 +13,4 @@ Simulation results from the Verilog representation of this Four-Bit Ripple Adder
1213

1314
## Source Files
1415
- **Four-Bit Ripple Adder Module** - four_bit_adder.v
15-
- **Four-Bit Ripple Adder Test Bench** - four_bit_adder_test.v
16+
- **Four-Bit Ripple Adder Test Bench** - four_bit_adder_test.v

Project 2 – Combinational Logic/full_adder/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Objective
44

5-
This full adder takes 3-bits for the input as A, B and Carry In. It outputs 2-bits as Sum and Carry Out. The Sum will be the lowest value output and the Carry Out is the highest value output as well as where other full adders could be joined together.
5+
This full adder takes 3-bits for the input (A, B and carry in) and outputs a 2-bit Sum and its corresponding Carry Out. The Sum will be the lowest value output and the Carry Out is the highest value output as well as where other full adders could be joined together.
66

77
## Waveforms
88

@@ -12,4 +12,4 @@ Simulation results from the Verilog representation of this Full Adder
1212

1313
## Source Files
1414
- **Full Adder Module** - full_adder.v
15-
- **Full Adder Test Bench** - full_adder_test.v
15+
- **Full Adder Test Bench** - full_adder_test.v

Project 2 – Combinational Logic/mux_four_to_one/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Objective
44

5-
This 4-1 multiplexer takes an input of four bits and another input of two bits and outputs the selected input. In this module, the two bits are the select bits that would select which one the inputs should be designated as the output.
5+
This 4-1 multiplexer takes an input of four bits and another input of 2-bits and outputs the selected input. In this module, the two bits are the select bits that would select which one the inputs should be designated as the output.
66

77
## Waveforms
88

@@ -12,4 +12,4 @@ Simulation results from the Verilog representation of this 4-1 Multiplexer
1212

1313
## Source Files
1414
- **4-1 Multiplexer Module** - mux_four_to_one.v
15-
- **4-1 Multiplexer Test Bench** - mux_four_to_one_test.v
15+
- **4-1 Multiplexer Test Bench** - mux_four_to_one_test.v

Project 2 – Combinational Logic/mux_four_to_one/mux_four_to_one_test.v

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,27 @@ module mux_four_to_one_test;
3232

3333
initial begin
3434

35-
// Initialize Inputs
36-
DIN = 0;
37-
SEL = 0;
35+
// Initialize Inputs
36+
DIN = 0;
37+
SEL = 0;
3838

39-
// Initialize counter variables
40-
count = 0;
41-
count2 = 0;
39+
// Initialize counter variables
40+
count = 0;
41+
count2 = 0;
4242

4343
// Loops over the possible combinations for SEL and resets the value for DIN
4444
for (count = 0; count < 4; count = count + 1) begin
45-
SEL = count;
46-
DIN = 0;
45+
SEL = count;
46+
DIN = 0;
4747

48-
// Loops over the possible combinations for DIN for each SEL value
49-
for (count2 = 0; count2 <= 16; count2 = count2 + 1) begin
50-
#5 DIN = count2;
48+
// Loops over the possible combinations for DIN for each SEL value
49+
for (count2 = 0; count2 <= 16; count2 = count2 + 1) begin
50+
#5 DIN = count2;
5151
end
5252
end
5353

5454
end
55-
// The test will run for a total interval of 340ns
56-
initial #340 $finish;
55+
56+
// The test will run for a total interval of 340ns
57+
initial #340 $finish;
5758
endmodule

Project 2 – Combinational Logic/priority_encoder/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Objective
44

5-
This priority encoder takes one four bit input and outputs the binary representation of the index of the active input bit with the highest priority. In addition, the module will indicate if the output generated is valid by toggling the valid bit, VLD. This solves the issue of having two inputs active at the same time by having the input of the highest priority take precedence.
5+
This priority encoder takes one 4-bit input and outputs the binary representation of the index of the active input bit with the highest priority. Also, the module will indicate if the output generated is valid by toggling the valid bit, VLD. This solves the issue of having two inputs active at the same time by having the input of the highest priority take precedence.
66

77
## Waveforms
88

@@ -12,4 +12,4 @@ Simulation results from the Verilog representation of this Priority Encoder
1212

1313
## Source Files
1414
- **Priority Encoder Module** - priority_encoder.v
15-
- **Priority Encoder Test Bench** - priority_encoder_test.v
15+
- **Priority Encoder Test Bench** - priority_encoder_test.v

0 commit comments

Comments
 (0)