How maazm007/4_bit_signed_calculator works
Project type and purpose
• This is not a software application but a digital‑hardware design targeting an FPGA (Xilinx ISE 14.7).
• It implements a 4‑bit signed “calculator” or mini‑ALU: it takes two 4‑bit operands (with sign bits), applies one of four arithmetic operations (add, subtract, multiply, divide), and produces a result.
File structure
• Top‑level directory:
• README.md (project description)
• “Xilinx Files”: generated netlists (.vf), symbol files (.sym), JHDL sources (.jhd), simulation artifacts (.wdb, .exe, .log), build scripts.
• “Xilinx Schematic Files”: the original schematic sources (.sch) that define each module’s internals.
• Key JHDL sources (.jhd) implement modules: Half_Adder, Full_Adder, Two’s_Complement, N‑bit Adders/Subtracters, Multiplier_4_Bit, Divider, MUXes, and the top‑level Adder_Calculator.jhd / Calculator.jhd.
• Simulation tree under “isim” shows how each module is instantiated and verified.
README
• Input pins: A[3:0], B[3:0], Sign_A, Sign_B, M1, M0
• Operation encoding on M1:M0
• Sign encoding on Sign_A:Sign_B for the two operands
• Four waveform screenshots demonstrating each operation
a. Main components (blocks):
• Input stage: two 4‑bit buses (A, B) plus two sign‑control pins (Sign_A, Sign_B)
• Sign‑extension units (Two’s_Complement blocks) for each operand – conditional invert & add‑one logic
• Arithmetic units:
– 4‑bit Adder module (built from Full_Adders)
– 4‑bit Subtracter module (similarly built, or via adder + two’s_complement)
– 4‑bit Multiplier block (Multiplier_4_Bit.jhd)
– 4‑bit Divider block (Divider.jhd)
• 4‑to‑1 Result multiplexer (Two_to_One_MUX and Four_to_One_MUX modules)
• Output bus (width depends on largest result—e.g., 8 bits for multiplication)
b. Relationships & interactions:
– Raw A, B feed into sign‑extension blocks, whose outputs are “signed” A′, B′.
– A′, B′ fan out to all four arithmetic units in parallel.
– Each arithmetic unit produces a candidate result.
– Control signals M1:M0 feed the top‑level multiplexer to select which unit’s output drives the final result bus.
c. Architectural patterns & principles:
– Data‑path / control‑path separation: sign‑extend + arithmetic blocks form the data‑path; M1, M0 form the control path.
– Hierarchical design: half‑adder → full‑adder → 4‑bit adder → ALU.
– Reusability: Two’s_Complement block reused for subtraction and sign handling.
d. Technologies & frameworks:
– JHDL (Java HDL) .jhd sources for RTL description, compiled into netlists (.vf) for Xilinx ISE.
– Xilinx schematic (.sch) files correspond one‑to‑one with JHDL modules, used for symbol generation (.sym).
– ISE simulator (.isim) artifacts for functional verification.
Detailed capturing of architectural elements
• Left zone: Sign‑extension (Two’s_Complement units) fed by raw inputs + Sign pins
• Center zone: Parallel arithmetic blocks (Adder, Subtractor, Multiplier, Divider) receiving the processed operands
• Right zone: 4‑to‑1 mux selecting final result based on M1:M0
• Beneath each block, annotate the source file names (e.g., “Multiplier_4_Bit.jhd / .sch”).