Update verilog.txt
Browse files- verilog.txt +9 -75
verilog.txt
CHANGED
|
@@ -3,78 +3,12 @@
|
|
| 3 |
|
| 4 |
This is an ALU module of the code for processor.
|
| 5 |
[ALU Module]
|
| 6 |
-
Line 1
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
Line
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
Line
|
| 15 |
-
// Data inputs
|
| 16 |
-
Explanation: Comment identifying the start of the input data signals.
|
| 17 |
-
|
| 18 |
-
Line 4 of ALU module:
|
| 19 |
-
input [63:0] a ,
|
| 20 |
-
Explanation: 64-bit input port for the first operand (Operand A).
|
| 21 |
-
|
| 22 |
-
Line 5 of ALU module:
|
| 23 |
-
input [63:0] b ,
|
| 24 |
-
Explanation: 64-bit input port for the second operand (Operand B).
|
| 25 |
-
|
| 26 |
-
Line 6 of ALU module:
|
| 27 |
-
input [4:0] alu_control ,
|
| 28 |
-
Explanation: 5-bit control signal that determines which operation (Add, Sub, etc.) to perform.
|
| 29 |
-
|
| 30 |
-
Line 7 of ALU module:
|
| 31 |
-
input [63:0] hi_in ,
|
| 32 |
-
Explanation: 64-bit input to read the current state of the High-order result register.
|
| 33 |
-
|
| 34 |
-
Line 8 of ALU module:
|
| 35 |
-
input [63:0] lo_in ,
|
| 36 |
-
Explanation: 64-bit input to read the current state of the Low-order result register.
|
| 37 |
-
|
| 38 |
-
Line 9 of ALU module:
|
| 39 |
-
input [4:0] shamt ,
|
| 40 |
-
Explanation: 5-bit input specifying the number of bits to shift during shift operations.
|
| 41 |
-
|
| 42 |
-
Line 10 of ALU module:
|
| 43 |
-
// Result outputs
|
| 44 |
-
Explanation: Comment identifying the start of the primary data output signals.
|
| 45 |
-
|
| 46 |
-
Line 11 of ALU module:
|
| 47 |
-
output reg [63:0] result ,
|
| 48 |
-
Explanation: 64-bit register output holding the main calculation result.
|
| 49 |
-
|
| 50 |
-
Line 12 of ALU module:
|
| 51 |
-
output reg [63:0] hi_out ,
|
| 52 |
-
Explanation: 64-bit register output for high-order bits (used in multiplication/division).
|
| 53 |
-
|
| 54 |
-
Line 13 of ALU module:
|
| 55 |
-
output reg [63:0] lo_out ,
|
| 56 |
-
Explanation: 64-bit register output for low-order bits (used in multiplication/division).
|
| 57 |
-
|
| 58 |
-
Line 14 of ALU module:
|
| 59 |
-
// Status signals back to control unit
|
| 60 |
-
Explanation: Comment identifying status flags sent to the CPU control logic.
|
| 61 |
-
|
| 62 |
-
Line 15 of ALU module:
|
| 63 |
-
output reg zero ,
|
| 64 |
-
Explanation: 1-bit flag that is high (1) if the result of the operation is zero.
|
| 65 |
-
|
| 66 |
-
Line 16 of ALU module:
|
| 67 |
-
output reg neg ,
|
| 68 |
-
Explanation: 1-bit flag that is high (1) if the result is a negative value.
|
| 69 |
-
|
| 70 |
-
Line 17 of ALU module:
|
| 71 |
-
output reg carry ,
|
| 72 |
-
Explanation: 1-bit flag indicating an unsigned arithmetic carry-out.
|
| 73 |
-
|
| 74 |
-
Line 18 of ALU module:
|
| 75 |
-
output reg overflow
|
| 76 |
-
Explanation: 1-bit flag indicating a signed arithmetic overflow (result sign error).
|
| 77 |
-
|
| 78 |
-
Line 19 of ALU module:
|
| 79 |
-
);
|
| 80 |
-
Explanation: Closes the module's port list declaration.
|
|
|
|
| 3 |
|
| 4 |
This is an ALU module of the code for processor.
|
| 5 |
[ALU Module]
|
| 6 |
+
Line 1: `timescale 1ns / 1ps - Sets simulation time unit to 1ns and precision to 1ps.
|
| 7 |
+
Line 2: module alu( - Defines the start of the Arithmetic Logic Unit (ALU) hardware module.
|
| 8 |
+
Line 3: // Data inputs - Comment indicating the start of input port definitions.
|
| 9 |
+
Line 4: input [63:0] a , - Declares a 64-bit wide input bus for the first operand 'a'.
|
| 10 |
+
Line 5: input [63:0] b , - Declares a 64-bit wide input bus for the second operand 'b'.
|
| 11 |
+
Line 6: input [4:0] alu_control , - Declares a 5-bit input to select the specific operation (opcode).
|
| 12 |
+
Line 7: input [63:0] hi_in , - Declares a 64-bit input for the current high-order bits of a result.
|
| 13 |
+
Line 8: input [63:0] lo_in , - Declares a 64-bit input for the current low-order bits of a result.
|
| 14 |
+
Line 9: input [4:0] shamt , - Declares a 5-bit input to specify shift amount for bitwise operations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|