
This project implements an 8-bit Sequential Arithmetic Logic Unit (ALU) in SystemVerilog (Top_ALU_secuencial). It integrates a 3-stage Kogge-Stone parallel prefix adder (prefix_adder) for addition and two's complement subtraction, bitwise AND/OR logic units, a 4-stage pipelined unsigned divider (divisor) with clock-gating enable and division-by-zero protection, and an architectural condition-flag generator (flags_nzcv) producing Negative (N), Zero (Z), Carry (C), and Signed Overflow (V) flags.
Input bus ui_in[7:0] loads 8-bit Operand A (reg_a) when uio_in[0] = 0 and 8-bit Operand B (reg_b) when uio_in[0] = 1. The 3-bit control bus uio_in[3:1] selects the ALU operation (000 = ADD, 001 = SUB, 010 = AND, 011 = OR, 101 = DIV quotient, 110 = REM remainder). The 8-bit registered result is output on uo_out[7:0] and the 4 status flags {N, Z, C, V} are output on uio_out[7:4].
ena = 1, rst_n = 0, ui_in = 0, and uio_in = 0 for 5 clock cycles, then release reset (rst_n = 1).ui_in[7:0], setting uio_in[0] = 0, and advancing 1 clock cycle.ui_in[7:0], setting uio_in[0] = 1, setting uio_in[3:1] to alu_control[2:0], and advancing 1 clock cycle.ADD, SUB, AND, OR) or 5 clock cycles for pipelined division (DIV, REM), then read the 8-bit result on uo_out[7:0] and the {N, Z, C, V} flags on uio_out[7:4].No external hardware is required.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | Operand bit 0 | Result bit 0 | Operand select (0=A, 1=B) |
| 1 | Operand bit 1 | Result bit 1 | alu_control[0] |
| 2 | Operand bit 2 | Result bit 2 | alu_control[1] |
| 3 | Operand bit 3 | Result bit 3 | alu_control[2] |
| 4 | Operand bit 4 | Result bit 4 | Flag V (Overflow) |
| 5 | Operand bit 5 | Result bit 5 | Flag C (Carry) |
| 6 | Operand bit 6 | Result bit 6 | Flag Z (Zero) |
| 7 | Operand bit 7 | Result bit 7 | Flag N (Negative) |