In online education, it is critical for the quality of education to evaluate and grade the assignments or examinations that students upload to the system. However, it is time-consuming to determine how well the circuit drawings prepared for the digital logic course, which is a fundamental course in computer engineering and similar disciplines, are not only correct but also compatible with the truth table. Content-addressable memory (CAM), also known as associative memory, is a data storage and retrieval unit. Typically, it is used instead of the conventional memories in fast-paced and time-sensitive applications such as address lookup in Internet routers, databases, and pattern recognition. CAMs implement the search process by comparing the content itself with a key instead of finding the address like the conventional memories. To see the effect of using binary content-addressable memory-based memory on the time spent scoring hand or digital-drawn logic circuits, it is compared with various data structures commonly used in logic simulation programs. I found a significant relationship (O(1)), indicating that the proposed architecture reduces the time complexity in the search process. This expression is the same as time complexity in hash tables.
The digital logic design course, which is a basic course in disciplines such as electrical, electronics, and computer engineering, is an important tool in the design of digital system. Traditionally, circuit design teaching is divided into combinational and sequential circuitry. However, this study focuses only on digital system designs built in a combinational circuit structure at the gate level. Logic diagrams constructed with symbolic representations of basic logic gates with a function given by Boolean equations or truth table are an important step in the design process. These diagrams are usually drawn using free or pen-and-paper sketches at first and then collaborated with a digital circuit simulator to test the functionality of the designed circuit. Several studies have been proposed to automate the process of exporting the digital-drawn circuit sketch to a software-based environment to verify for correctness in functionality and in timing [1,2,3,4,5]. The styles used in the drawing of logic gates may vary from one person to another. Correctly interpreting different styles of drawings for a circuit is a tedious task. In recent years, machine learning and image processing algorithms have been used to identify components in free sketch to solve these issues [6,7,8,9,10]. These developments have contributed to the reliability in the identification of components in digital system designs built by the free sketch method. This has led to the possibility of machine-based evaluation of student works in digital logic design course. There has been a serious increase in the transfer of materials used in education to the Internet environment, especially with the COVID-19 pandemic. In addition, this tool will contribute to the evaluation of student-based studies in an environment where online education has become widespread with the COVID-19 pandemic. However, there is a problem here: as the number of students increases, student projects will need to be scored automatically. Because simulating the functionality of each design uploaded to the system is required for grading, such simulation can require many times to complete. This adversely affects the project evaluation period. This is due to the gate-level simulation to verify the logical correctness of the circuit. In this simulation, a table lookup called a netlist is used, which keeps primitive logic gates of the circuit and their connectivity information. The bottleneck of the gate-level simulation performance is due to the poor performance of memory. In other words, read–modify–writeback operation will be done in memory for each logic gate in the circuit. This is essentially a searching problem and again is memory-intensive. This research is motivated by the desire to replace the RAM with content-addressable memory (CAM) to overcome the performance bottleneck in the search process in the lookup table.
Nowadays, the rapid advancement of technology makes us in need of faster computing systems with higher efficiency. The use of CAM, which is also known as associative memory, can provide these features . Unlike conventional memories, CAM uses its parallelism property to search for a part of or an entire stored data (content) within the memory unit in a single clock (CLK) cycle. Random-access memory (RAM) is an example of conventional memories, which requires knowing the location address of the stored data first to extract it. Therefore, it needs multiple CLK cycles to find the desired content, which makes it time-consuming as compared to the CAM .
Since the parallelism in CAMs enhances the search process, CAMs simultaneously search all memory cells for the desired content using a key in a single CLK cycle and return the matched contents by a parallel active circuit . The utilization of parallel active circuitry causes an increase in power dissipation and hardware cost. To overcome this, different energy-saving designs and technologies for CAMs are proposed in the literature. Eshraghian et al.  proposed a new approach of modeling CAM by using memory resistor (memristor)-based CAM where the non-volatile characteristic and the nanoscale geometry of using a combination of memristor MOS devices to help to increase the packing density. Abdelhadi and Lemieux  proposed a technique for building up binary content-addressable memory (BiCAM) by using the standard SRAM blocks in field-programmable gate arrays (FPGAs). Also, they used the hierarchical search method to achieve higher storage efficiency. Kim and Kim  have presented a small-area and low-power static architecture BiCAM based on Nano-Electromechanical Memory Switch for nonvolatile data storage. Satyanarayana and Sridevi  proposed a pre-charge controller-based ternary content-addressable memory (TCAM) architecture. Where the pre-charge controller predicts the mismatched lines in the pre-charge phase, their design exhibits a 16.6% reduction in power. Riaz et al.  proposed a cell design of the TCAM in order to reduce power consumption. They reviewed the architectural level and optimized solution of their design, which can be used as BiCAM or TCAM.
Despite all these drawbacks, CAMs have a well-suited throughput and response time for data-intensive and time-sensitive applications. They are considered as a good trade-off and popular for many applications such as packet forwarding and packet classification in network routers, data compression, artificial neural networks, network security, and pattern recognition and matching [19,20].
The existing CAMs are divided into two types: BiCAM, where each unit cell of the memory can have either “0” or “1” states and TCAM that has the same cell states as the BiCAM with an additional “don’t care” (“X”) state . Based on the implementation technique, CAMs are categorized as application-specific integrated circuit (ASIC)-based (conventional) and FPGA-based . Contrary to ASIC, an FPGA device is a useful platform for digital system designers because of its super-flexibility and reconfigurability. However, most FPGA architectures do not have a CAM block unit. Multiple methods are presented for the FPGA-based CAM design. These methods include block RAM (BRAM)-based CAMs , distributed RAM-based CAMs , and flip-flop-based CAMs .
In this article, it is focused on the problem of searching the netlist memory map generated for the digital circuit to verify the functional description for digital circuits. This research tries to demonstrate the features of using CAMs instead of conventional memories by providing a comparison between an FPGA-based digital circuit examiner by using two different approaches, BiCAM and RAM, and discuss their results in terms of resource usage and latency. The data samples can be obtained by reading a handwritten logic circuit design by using the machine learning technique , mathematical morphology operations , and Fourier descriptors , where the used inputs, outputs, and the used components are scanned and listed. The remainder of this article is structured as follows: In Section 2, the structure of the conventional BiCAM is explained. Section 3 discusses how the BiCAM-based netlist table architecture is implemented, while Section 5 details the proposed work. In Section 5, the performance results of logic circuit evaluation by using both CAM and RAM approaches are explained. In Section 6, the entire work of this study is concluded.
2 BiCAM organization
Generally, a BiCAM is organized in such a way:
• Argument register: it consists of n-bits of the desired word (content) to be searched for.
• Key register: it consists of n-bits and specifies, which bits part of the argument register needs to be compared with words in memory. If all bits within register are set to 1, the entire word should be compared. Otherwise, only the bits that set to 1 will be compared.
• Associative memory array: it consists of the words (content nxm bits) that are going to be compared with the argument register.
• Match register: it consists of m-bits, each bit is corresponded to one word in the memory array, and if the match happens, the corresponding bit is set to 1.
To understand how BiCAM works, a simple CAM model is given in Figure 1. Where it is clear that the CAM consists of 5 words (rows) and each word has 4 bits (CAM cell), so in total it is 20 CAM cells. Each cell of the CAM has two tasks: data storage and comparison. For each word, there is a matching line attached to the match register. There is also a search line for each cell attached to the corresponding bit of the key register. The search process in CAMs begins by loading the value of the required search data into the argument register; then, the value gets masked with the key register to have only the desired bits remaining. The comparison process occurs for each CAM cell by comparing its stored bits against the bits in their corresponding search lines. The match lines will have the value of the comparison results where it shows if the match condition occurred or not. The circuit that will do the matching for a word in the CAM is given in Figure 2.
3 BiCAM-based netlist table architecture
The BiCAM memory design proposed in this study was implemented on Altera’s EP2C70F896C6 FPGA board. The design contains bit cells, comparison unit, ROM (read only memory), and encoder modules. The inputs of proposed design are as follows: CLK, write or read enable (W_R), reset, 8-bit address pin, 15-bit argument register, 15-bit key register, 8-bit match register, and 15-bit data input. Each bit cell of the BiCAM has consisted of two main components: The first one is flip-flops on which the data can be stored or retrieved and the second one is a comparison circuit to check whether there is a match that occurs between the stored value within the flip-flops and the search value that will come from the argument register. Each bit cell of the BiCAM is provided with a comparison circuit that is connected to its corresponding flip-flop’s output and search value as input where a logically comparing operation is realized. The output of this comparison circuit is connected to the match flag register. In Figure 3, the RTL diagram of the bit cell is given.
The designed Bit_cell (shown in Figure 3) module was duplicated sequentially to form an entire row (string) consisting of 15 columns by using the generate function in the VHDL language. Each row of the BiCAM has its match line that is linked to the outputs of the comparison circuits of each bit cell of the related row. To have the array-shaped design of the proposed BiCAM, the generate function is used again to create a 256 × 15 Bit_cell array (matrix). To initialize the proposed BiCAM with desired initial data, a storage unit should be used to load the initial data into the BiCAM during the initialization process. For the proposed design, a ROM was suggested to be used as the storage unit as it is suitable for the proposed design and only load data into the BiCAM are required. The vendor-specific intellectual property core IP blocks are a useful tool and became a common design methodology when designs are bigger and more complicated. Using Megafunctions instead of writing your code is considered a time-saving method while designing FPGA. Altera provides multiple types of memories in Megafunctions such as ALTSYNCRAM, ALTDPRAM, ALT3PRAM, and LPM_RAM_DQ Megafunctions.
The 1-port lpm_ROM Megafunction is chosen for the proposed design, where it is fully parameterizable and allows both synchronous and asynchronous single ports. The lpm_ROM needed to be initialized with desired initial data while configuring. A memory initialization file (.mif) or hexadecimal (.hex) file should be used with the same name as the lpm_ROM in the project directory. Each row of the proposed BiCAM represents a single data (word) and is connected to its match_line, which is already connected to the 256-bit match_flag register. The last part of the design presented in this study is an encoder circuit that gives the address of the data in the CAM. The inputs of this circuit are the outputs of the register consisting of match flags that indicate whether the searched data are found in each line of the CAM. Since the CAM consists of 256 rows in our design, the encoder circuit used is in 256 × 8 format.
4 Proposed work
In this study, netlist files obtained by machine learning-based or another methods were used for the recognition of hand-drawn digital circuits. The accuracy level of the outputs produced for a specified set of inputs for the logic circuit functions in this file has been determined by the FPGA-based BiCAM memory approach. The proposed work is divided into two task blocks: mapping circuit and logic engine as shown in Figure 4.
The mapping phase generates the configuration memory for input circuit design according to the netlist file. In other words, the memory image of the circuit is obtained. In this study, it is assumed that digital circuits consist of primitive gates with two inputs. The first and second columns in BiCAM store the input variables that correspond to a particular gate. The third column stores the output variable of each gate. The last column stores the type information of the Boolean primitive in the logic circuit. A three-bit encoding scheme is required to represent all logic gates. Table 1 shows the encoded notation used to express the different gate types in the study.
A 4-bit space is reserved for each input and output variables in the circuit. A maximum of 16 variables can be encoded with this 4-bit notation. This format used in the study has no basis and is given only for illustration. Depending on the size of the circuit, the bit space in the notation can be increased or decreased. The encoding of the variables is determined according to their order in the netlist file. For example, if the first line in the file is “and: g1 in: x y out n1,” the input x here will be encoded as 0001, and the variable y will be encoded as 0010, and if the output variable is n1, it will be encoded as 0011. The empty variables in the netlist file will be represented as “0000.” This situation is summarized in Table 2.
|0000||—||The empty variable|
|0001||1st||Variable in the file|
Based on this information, Table 3 illustrates the memory map of logic circuit based on the netlist file shown in Figure 4. The algorithm shown in Figure 5 can be divided into three phases. These are evaluating, updating, and scheduling.
|0||0001 0010 0011 001|
|1||0001 0010 0100 011|
|2||0011 0000 0101 000|
|3||0101 0100 0110 011|
The evaluation phase starts with the step of searching the netlist of each minterm in the answer key file and transferring their input signals to the relevant variables. Then, the output of Boolean primitive is evaluated according to these input signals. If a change occurs in the output signal of a gate, the logic engine first updates the output and records it as an event for later evaluation. These events are thrown into the running queue according to the FIFO structure. After evaluating and updating the netlist file according to the relevant minterm in the answer key, all events in the queue are executed one by one.
To prove the algorithm, a small circuit is made to test various types of Boolean primitives. The following steps show the operation of algorithm on the circuit, a full adder with only the output of sum. One of the XOR gates was intentionally opened to AND, OR, and NOT gates so as not to expand the schematic design of the design.
Step 1: The netlist and answer key files creating for the example circuit.
Step 2: Retrieving the minterm expression (product term) from answer key file and evaluating in all related words of the netlist memory map.
Step 3: Evaluating each event in the event queue according to the FIFO rule as in Step 2 and continuing the process until the queue is empty.
Step 4: Updating the evaluation score: Since S = 1 in the netlist file, the evaluation score is updated (score++) and go to Step 1.
The aforementioned steps are repeated for the other three input vectors in the answer key file, and the evaluation score is obtained. If the score found is equal to the number of input vectors in the answer key, it indicates that the logic circuit is working perfectly. Otherwise, it is concluded that the circuit produces wrong results in some input vectors and the schematic design of the circuit should be checked again.
5 Evaluation and experimental results
This section will present how to evaluate all the materials discussed in previous sections for the use of CAM in evaluating digital logic circuits for logical accuracy. A simple test circuit is presented in Section 4 to demonstrate how the proposed design meets expectations. The performance of the design is demonstrated by comparing the traditional RAM and CAM structures of the netlist file required to compute the output of a gate with a given input vector. The problem of the search task for the computation takes up a major portion of the evaluation time of the digital circuits. In this section, three different architectures will be examined and discussed to compare the performance in the search task also by the logic simulation software . These are linear scanning, parallel linear scanning, and parallel linear scanning with binary tree.
In the linear searching, the logic evaluation block may perform a search operation, continuously searching for a gate suitable according to the given input vector in memory. This search requires O( ) time in a memory with elements. In order to speed up the search process and save time, the linear memory space should be subdivided for concurrently search. For example, if the memory space with elements is divided into subpartitions with elements, the time complexity of the search process will be O( ) + O( ). Here, O( ) denotes the search time in each subdivision, while O( ) denotes the search time between the results obtained from these subdivisions. If the results from the subdivisions are organized with a binary tree structure architecture, the time complexity will be O( ). Table 4 summarizes the architectures presented in this section to demonstrate the effectiveness of the design.
|Linear search (LS)||O( )||O(1)|
|Parallel LS (PLS)||O( ) + O( )|
|PLS with binary tree||O( )|
When the table is examined, the search algorithms have different times of complexity depending on the size of the and numbers; in case, they use RAM-type memory. The fastest algorithm in this table is PLS with binary tree, but as the number of roots in the binary tree structure increases, the resource usage may reach the maximum level or even not be enough. If = , it is the PLS algorithm with optimal performance (O( )) among the search algorithms in this table. Considering that the performance of the software-based search algorithm is O( ), the search speed will increase times ( ). In the CAM-based memory usage proposed in this study, the time complexity will be O(1) in all algorithms.
The inclusion of image processing, machine learning, and other technologies in the education process contributes to the evaluation process of the courses. The schematic design of digital circuits is of great importance in the digital design course, which is one of the basic courses of departments such as electrical, electronics, and computer engineering. In this course, students are given homework and projects to increase their experience. The evaluation process of these designs is a laborious task and takes time. Along with human–computer interaction, the schematic design of digital circuit can be diagnosed with machine learning methods in recent years. In this study, we placed the netlist file of a circuit obtained by machine learning into a CAM with a time complexity of O(1) instead of a conventional RAM. In this way, the verification process of the circuit obtained by the machine learning method is faster than the other algorithms mentioned in the study. There is a data structure known as a hash table or map in the literature, which is the same as the time complexity of the proposed design. It uses a hash function (key) to create this structure. However, a reasonable choice of “key” calculation algorithm for each datum in the table and strategies such as mass storage maintenance or key recalculation to accommodate collisions are obstacles to this data structure. CAM is a hardware solution to this problem. The comparison circuit in CAM’s architecture uses more resources than conventional RAM. This proposed design will consume more resource usage, but, as a trade-off, will achieve the logic circuit evaluation process faster. The effect of CAM on the time complexity in the search process has led to the emergence of varieties of these memory types in the literature. The implementation of other CAM types in the literature, which are more efficient in terms of resource and power usage instead of memory in the proposed architecture, is considered in future studies.
There is no acknowledgement for this article.
Funding information: Author states no funding involved.
Author contributions: Halit Öztekin – conceptualization, methodology, formal analysis, investigation, supervision, validation, visualization, writing – original draft, and writing – review and editing.
Conflict of interest: The author declares that there are no conflicts of interest.
Data availability statement: The datasets generated during and/or analyzed during the current study are available from the corresponding author on reasonable request.
Ethical approval: The conducted research is not related to either human or animal use.
 Liwicki M, Knipping L. Recognizing and simulating sketched logic circuits. In: Khosla R, Howlett RJ, Jain LC, editors. Proceedings of the Ninth International Conference on Knowledge-based Intelligent Information and Engineering Systems. P. 3683, 2005 September 14–16; Melbourne, Australia. Berlin: Springer; 2005. p. 588–94. 10.1007/11553939_84.Search in Google Scholar
 Alvarado C, Davis R. Sketch READ: a multi-domain sketch recognition engine. In: Agrawala M, Wobbrock JO, Adar E, Setlur V, editors. Proceedings of the 17th Annual ACM Symposium on User Interface Software and Technology. 2004 October 24–27; Santa Fe, NM, USA. New York: Association for Computing Machinery; 2004. p. 23–32. 10.1145/1029632.1029637.Search in Google Scholar
 Alvarado C, Kearney A, Keizur A, Loncaric C, Parker M, Peck J, et al. LogiSketch: a free-sketch digital circuit design and simulation system. In: Hammond T, Valentine S, Adler A, Payton M, editors. Proceedings of the Workshop on the Impact of Pen and Touch Technologies in Education. Cham: Springer; 2015. p. 83–90. 10.1007/978-3-319-15594-4_8.Search in Google Scholar
 Zamora SW, Eyjólfsdóttir E. CircuitBoard: sketch-based circuit design and analysis. Proceedings of International Conference on Intelligent User Interfaces (IUI) Workshop on Sketch Recognition. Sanibel Island, FL, USA: 2009.Search in Google Scholar
 Alzubi J, Nayyar A, Kumar A. Machine learning from theory to algorithms: an overview. In: George A, Pandian S, Vinothina V, Donald C, editors. Journal of Physics: Conference Series. vol. 1142(1), 2018 December 5; Karnataka, India: IOP Publishing; 2018. p. 012012. 10.1088/1742-6596/1142/1/012012.Search in Google Scholar
 Kia M, Alzubi J, Gheisari M, Zhang X, Rahimi M, Qin Y. A novel method for recognition of Persian alphabet by using fuzzy neural network. IEEE Access. 2018;6:77265–71. 10.1109/ACCESS.2018.2881050.Search in Google Scholar
 Boutaba R, Salahuddin MA, Limam N, Ayoubi S, Shariar N, Estrada-Solano F, et al. A comprehensive survey on machine learning for networking: evolution, applications and research opportunities. J Int Serv Appl. 2018;9(16):1–100. 10.1186/s13174-018-0087-2.Search in Google Scholar
 Abdel-Majeed M, Almousa T, Alsalman M, Yosf A. Sketic: a machine learning-based digital circuit recognition platform. Turkish J Electr Eng Comput Sci. 2020;28(4):2030–45. 10.3906/elk-1910-16.Search in Google Scholar
 Fan X, Ghonem A, Gemmeke T. Content-Addressable Memory – Overview and Outlook of an Enabler for Modern Day Applications. ANALOG 2018. 2018 September 13–14; Münich, Germany: 2018. p. 1–6.Search in Google Scholar
 Mohammad K, Qaroush A, Washha M, Mohammad B. Low-power content addressable memory (CAM) array for mobile devices. Microelectron J. 2017;67:10–8. 10.1016/j.mejo.2017.07.001.Search in Google Scholar
 Sivakumar SA, Swedha A, Naveen R. Survey of content addressable memory. Int J Creative Res Thoughts. 2018;6(1):1516–26.Search in Google Scholar
 Eshraghian K, Cho KR, Kavehei O, Kang SK, Abbott D, Steve Kang SM. Memristor MOS content addressable memory (MCAM): Hybrid architecture for future high performance search engines. IEEE Trans Very Large Scale Integr (VLSI) Syst. 2011;19(8):1407–17. 10.1109/TVLSI.2010.2049867.Search in Google Scholar
 Abdelhadi AMS, Lemieux GGF. Modular SRAM-based binary content-addressable memories. In: Shannon L, Andrews D, editors. IEEE 23rd Annual International Symposium on Field-Programmable Custom Computing Machines. 2015 May 2–6, Vancouver-British Columbia: IEEE Computer Society; 2015. p. 207–14. 10.1109/FCCM.2015.69.Search in Google Scholar
 Kim H, Kim Y. Binary content-addressable memory system using nanoelectromechanical memory switch. International SoC Design Conference (ISOCC); 21–24 October, 2020. p. 270–271, Yeosu-Korea. 10.1109/ISOCC50952.2020.9332913.Search in Google Scholar
 Satyanarayana SVV, Sridevi S. Design of TCAM architecture for low power and high performance applications. Gazi Univ J Sci. 2019;32(1):164–73.Search in Google Scholar
 Riaz H, Bhatti AA, Tahir MA, Sarwar M. High speed content addressable memory with reduced size and less power consumption. In: Baktir S, Tosun S, Sekanina L, editors. 2016 International Conference on Design and Technology of Integrated Systems in Nanoscale Era (DTIS). 2016 April 12–14; Istanbul-Turkey: IEEE; 2016. p. 1–6. 10.1109/DTIS.2016.7483897.Search in Google Scholar
 Jiang S, Yan P, Sridhar R. A high speed and low power content-addressable memory(CAM) using pipelined scheme. In: Büchner T, Wei S-J, Zhao D, Bhatia K, editors. 28th IEEE International System-on-Chip Conference (SOCC). 2015 September 8–11; Beijing-P. R. China: IEEE; 2015. p. 345–9. 10.1109/SOCC.2015.7406979.Search in Google Scholar
 Mujahid O, Ullah Z. High speed partial pattern classification system using a CAM-based LBP histogram on FPGA. IEEE Embedded Syst Lett. 2020;12(3):87–90. 10.1109/LES.2019.2956154.Search in Google Scholar
 Datta R, Mandal PDS, Chanda B. Detection and identification of logic gates from document images using mathematical morphology. In: Biswas PK, editor. Fifth National Conference on Computer Vision, Pattern Recognition, Image Processing and Graphics (NCVPRIPG). 2015 December 16–19; Patna-Bihar-India: IEEE; 2015. p. 1–4. 10.1109/NCVPRIPG.2015.7490040.Search in Google Scholar
 Gül N, Tora H. Recognition of hand-sketched digital logic gates. 23nd Signal Processing and Communications Applications Conference (SIU). 2015 May 16–19; Malatya-Turkey: IEEE; 2015. p. 1921–4. 10.1109/SIU.2015.7130236.Search in Google Scholar
 Jiyong A. A Custom Architecture For Digital Logic Simulation [Doctoral Dissertation]. University of Pittsburgh; 2002.Search in Google Scholar
© 2022 the author(s), published by De Gruyter
This work is licensed under the Creative Commons Attribution 4.0 International License.