Tim Edwards
04/27/2022, 7:25 PMA for digital devices where Xyce uses U, the general implementation is very similar in both simulators. The idea here is that you have a single digital behavioral device type called "LUT" (look-up table) that can arbitrarily map any combinatorial function of N inputs and M outputs. It declares its N and M inputs and outputs, and one extra parameter called table_values where table_values is a character string representing the output values for every input combination of 0 and 1. So table_values="01" is a buffer, table_values="0001" is a 2-input AND gate, table_values="1111100010001000" is a 2x2-input OAI gate. It has the great advantage of (1) being easy to implement, and (2) being able to be mapped by a simple script to the entire combinatorial logic gate set of any standard cell library. For the ngspice version, I wrote a script that parses a standard cell library liberty file for all the "function()" records, decodes the function, and then automatically converts any SPICE netlist using standard cells to its digital equivalent. I have used that process to do mixed-mode simulations of complete RISC-V cores in ngspice.