The topic
A hardware Trojan is extra logic that stays dormant on almost every input and changes the function on a rare trigger. Students add a combinational trigger and a payload to a locked adder.
Where it belongs
Course: Digital logic.
Teach this after: detecting one input value and writing a conditional assignment. If you also assign the locking lab, do this lab second. The starter file is already locked. The lab is written and has not been graded yet.
Files and how to use them
There is no slide deck. The manual is the assignment. Students change only the marked region of the locked adder.
- Lab manual. The five parts of the report and the questions. Use it as the in-class handout.
- FullAdder.vhdl. Provided so the design compiles. Students do not modify it.
- 4BitAdder_Key.vhdl. The locked adder. The trigger and the payload go where the file marks the spot. That region is empty in the starter.
- tb_4BitAdder.vhdl. The testbench students simulate. The manual names the file
tb_4BitAdder_Key.vhdl. The file in this bundle istb_4BitAdder.vhdl.
Video lectures
These are links, not files stored with the module. Play one in class, or send the link to students.
Further reading
Optional papers for the instructor, or for a student who wants to read past the assignment.
- Bhunia, Hsiao, Banga, and Narasimhan, “Hardware Trojan Attacks: Threat Analysis and Countermeasures,” Proceedings of the IEEE, vol. 102, no. 8, pp. 1229–1247, 2014.
- Xiao, Forte, Jin, Karri, Bhunia, and Tehranipoor, “Hardware Trojans: Lessons Learned After One Decade of Research,” ACM Transactions on Design Automation of Electronic Systems, vol. 22, no. 1, 2016.
The exercise
Students receive the adder already locked. They do not modify the full adder and they do not modify the locking equations. The work is a trigger and a payload. The trigger is combinational, looks only at the two operands, and asserts on a single combination the student chooses. The payload runs only while the trigger is asserted and changes at least one bit of the key before that key reaches the locking gates. For every other input the adder still behaves as the lock intends.
Outcome
The sum is correct everywhere except the trigger combination, where the altered key corrupts the carry chain. The student explains why the Trojan is invisible on every other input, and how a one-bit change in the key becomes a fault that ripples into the higher bits.
The five parts of the report
- Read the lock. Explain the key port and both locking styles. The provided architecture uses XOR and XNOR on the masked carries. A multiplexer version is left in comments.
- Design the trigger. Pick one pair of operand values. Implement it as combinational logic on a signal named
trigger. Say why that pair is rare. - Design the payload. Build a modified key that differs from the real key only when
triggeris 1, and only in at least one bit. Leave the obfuscation equations alone. - Simulate both cases. The supplied testbench holds carry-in at 0, drives the key port with
010, and walks the operand space. Find the activation in the waveform. Show A, B, the sum, and carry-out in unsigned decimal. - Explain the hiding. Which key bit changed, how that change moves through the carry chain, and why every other input still looks like a correct, locked adder.
The starter file marks the region where the trigger and payload belong and does not contain them. Completing that region is the lab.



