Detecting vulnerable code blocks has become a highly popular topic in computer-aided design, especially with the advancement of natural language processing (NLP). Analyzing Hardware Description Languages (HDL), such as Verilog, involves dealing with lengthy code. This study introduces an innovative identification of attack-vulnerable hardware by the use of opcode processing. Leveraging the advantage of architecturally-defined opcodes and expressing all operations at the beginning of each code line, the word processing problem is efficiently transformed into opcode processing. This research converts a benchmark dataset into an intermediary code stack, subsequently classifying secure and fragile codes using NLP techniques. The results reveal a framework that achieves up to 94% accuracy when employing sophisticated Convolutional Neural Networks (CNNs) architecture with extra embedding layers. Thus, it provides a means for users to quickly verify the vulnerability of their HDL code by inspecting a supervised learning model trained on the predefined vulnerabilities. It also supports the superior efficacy of opcode-based processing in Trojan detection by analyzing the outcomes derived from a model trained using the HDL dataset.
Deep neural networks deployed in real-world systems may produce unreliable predictions when encountering inputs outside the training distribution. Detecting such out-of-distribution (OOD) inputs during inference is therefore critical for reliable deployment. We propose a lightweight monitoring framework that observes intermediate neural network embeddings and detects abnormal inputs using hyperdimensional computing (HDC). The monitor converts embeddings into binary hypervectors via random projection and sign encoding, and evaluates distance to class prototypes using only XOR and population-count operations. Experiments using CIFAR-10 as the in-distribution dataset and SVHN and CIFAR-100 as OOD datasets show that the proposed method achieves strong detection performance with highly efficient binary computation.