Friday, December 30, 2016

Encrypting files with the Simon Cipher in CBC

Until last week, there was a single problem from the PWL generation side with simontool, and it is that it does not make assumptions of how the initial state of the keys is set. Well, now I can add how the XOR for CBC stream encryption is done.
If you want to use simontool to encrypt a file, you should first look at my post of encrypting files with the simon cipher because of the quirks with the keys. The default behavior is ECB, but the -m flag now allows CBC behavior. The CBC mode is included in the file header. An example of the encryption is:
Encrypt the file, testfile.txt:
simontool -e -m cbc -b 128 -k 128 -s 0f0e0d0c0b0a09080706050403020100 -i testfile.txt -o testfile.simon
Decrypt the file testfile.simon, use the expanded key:
simontool.elf -d -b 128 -k 128 -s 6413494fda72360d1cb8547cd58c4df9 -i testfile.simon -o testfile.txt

Wednesday, December 28, 2016

Encrypting files with simontool and the Simon Cipher

Outside of the authors of the simon cipher, I probably know more about the cipher than anyone else. I've written the tools for hardware implementation (one day, the IEEE will approve the paper). I've spent a lot of time encrypting multiple blocks and looking at the strobe outputs. The simontool program can encrypt a file as EBC. I do not support CBC yet because I cannot make assumptions about the hardware chaining.

Let's use simontool to encrypt a file with the simon cipher. It helps to start with the manual file, but here's the summary. I do not give you a way to generate a key from text at this point, so you will need a key. Let's assume SIMON128/128 and pick the test key from the 0f0e0d0c0b0a09080706050403020100. This key is the encryption key, so we first need to also generate a decryption key.

simontool -e -b 128 -k 128 -s 0f0e0d0c0b0a09080706050403020100 -t 0 -y

This will print out the complete key expansion, and the key we want is the "final key" entry. The -t flag is generally used to encrypt a single block and the -y flag dumps the key expansion to stdout.
key[65]: e4eaaf3ba3196adfd49c399343c9c09a 
key[66]: 29b0397872648490e4eaaf3ba3196adf 
key[67]: 1cb8547cd58c4df929b0397872648490 
final key: 6413494fda72360d1cb8547cd58c4df9 
data: 13914e4e9aec8f25bb849374e01139aa 

Encrypt the file, testfile.txt:
simontool -e -b 128 -k 128 -s 0f0e0d0c0b0a09080706050403020100 -i testfile.txt -o testfile.simon
Decrypt the file testfile.simon, use the expanded key:
simontool.elf -d -b 128 -k 128 -s 6413494fda72360d1cb8547cd58c4df9 -i testfile.simon -o testfile.txt

Now, what if you forget you key? I cannot help you, but if you forget the format, the header of the encrypted file has some information:
SIMON                 11 128 128
The format from the manual:
 header is 32-bytes in total:    
          8 for the word SIMON
          8 for nothing
          4 for nothing
          4 for offset padding (most likely a value < 8)
          4 for key size information 
          4 for block size information 

Friday, December 16, 2016

Numbers larger than 64-bits in BASH

Necessity is the mother of invention. When dealing with number theory, particularly cryptography, you have large numbers. I have many tools that I have written to support my semiconductor work, and many of these output "large numbers". BASH has limitations to numbers size. I have created a BASH library that allows me to do arbitrary bit-width operations on binary representations of strings.

The first thing that is required is my "bashbignumbers.sh" function library. You then can do simple arithmetic. In the following example, I create a 4096 bit number that is full of "0"s. I then increment the number, negate it, and convert it back into hex.
source "bashbignumbers.sh"
RESULT=$(bashUTILzerowidth 4096)
RESULT=$(bashINCbinstring $RESULT)
RESULT=$(bashNEGbinstring $RESULT)
RESULT=$(bashUTILbin2hex $RESULT)
echo "$RESULT"
The result is:
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
And that is the 2's compliment representation of -1

Monday, November 28, 2016

Dear Mr(s) President, I want to be the Ambassador to Ghana.

To current, past and future presidents: I want to become the Ambassador to Ghana. I would be an excellent candidate for the job because I am a skilled political manager. (anyone who gets their Ph.D. has this skill). Primarily, I have found that most Ambassadors are a bit removed from the countries where they are representing the USA. As a fluent Japanese speaker, I would be more qualified for Ambassador to Japan, but if you look at the link, you will find that it's the award for campaign contributions. I'm really unable to find someone in recent years that I could be proud from the standpoint of increasing mutual cooperation. In an effort to be appropriate for Ghana, my Twi is not yet fluent, but it will be.

So why Ghana?
It's refreshing to find a country in Africa that has its act together. I read The Economist every week, and have been to Ghana multiple times. Ghana is one of those places where the people are proud of their achievements and government, and in 50 years I imagine it to be a powerhouse of industry like Japan or China (their VAT is a bit of an issue, but...) The people are hard working and industrious. A good example of the quality of the populous is that the country remained stable during power transition after President Mills died in office. All in all, it's a great country and it would be a privilege to be part of its international rise.

Sunday, November 20, 2016

68060 for the NeXT.

Although this is completely worthless as far as real-world item, I really want to get back to making a 68060 socket for the NeXT Slab. I got up to the point where I reverse engineered the Nitro board, ordered the logic, but I never sent out the board. Maybe one day I can justify the time, but I doubt that day will come. :(

Friday, November 18, 2016

Gate Equivalents (GE) and why you should not use them.

I was introduced to Gate Equivalents (GEs) from using Xilinx layout tools, where the routed graph estimates how many NAND gates would be required for an implementation of a circuit. I keep reading papers were people use GEs as a comparison between designs, but it seems that the GE does not seem to have a standard definition. In many cryptography papers, the GE is used as an area comparison; however, this can be misleading. Let's say that you have a standard cell library with a large NAND gate, which is one GE. Now let's say that you have an XOR that is heavily optimized for area, and in this case, the XOR could have the same area of a NAND gate even though it requires more transistors.

Here is how people seem to game the system when GE is used as area. I make a NAND that is very large. This makes my total design take much less area in GEs for the other optimized cells. I just saw a design on 130nm that has fewer transistors with a higher GE than a design that has more transistors and a lower GE.

Instead of GEs, use transistor count. This just make sense. Here's an example of the layout of 8 transistors in a commercially available 14nm process:


This layout is substantially different from a 130nm equivalent. The attempt to compare different layouts and feature sizes with GEs is just worthless. Just don't do it.

Monday, November 14, 2016

Logic with large numbers in Bash

I found that I was losing information when passing information between commands via bash. Bash cannot seem to deal with numbers larger than 64-bits. The solution was for me to change everything into an ASCII series of 0's and 1's and then run logic on the strings. The code below takes a hexadecimal number, 549b93563bfa04fb, splits it in two, and XOR's the halves. I tried the code on a 4096-bit number and it worked well.
 #!/bin/sh  
 #Before anything else, set the PATH_SCRIPT variable  
      pushd `dirname $0` > /dev/null; PATH_SCRIPT=`pwd -P`; popd > /dev/null  
      PROGNAME=${0##*/}; PROGVERSION=0.1.0   

 lowercase(){  
 # convert the uppercase to lowercase  
   echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"  
 }  
 bashhex2bin()  
 {  
 # Take a value as a hex number and convert it to a binary string  
 #  
  HEXVAL=$1  
  #echo "$@"  
  #echo "$#"  
  if [ "$#" -lt 1 ]; then  
   # this means that the function was run without any arguments  
   : #null command to make BASH happy  
  else  
   #echo "bashhex2bin(): total args passed to me $#"  
   STRSIZE=${#HEXVAL} #the string length of the argument  
   for ((COUNTER1=0; COUNTER1 < STRSIZE ; COUNTER1++))  
   do  
    #echo "Welcome $COUNTER1 times"  
    CHARATINDEX=${HEXVAL:$COUNTER1:1}  
    #convert the hex value to binary  
    bashchar2bin $CHARATINDEX  
   done   
  fi  
 }  
 bashchar2bin()  
 {  
 # Take a nibble as an argument, and return a binary represntation  
 #  
  NIB=$1 #this should be 0 to F  
  NIB=$(lowercase $NIB)  
  case $NIB in  
   "0" )  
     printf "0000" ;;  
   "1" )  
     printf "0001" ;;  
   "2" )  
     printf "0010" ;;  
   "3" )  
     printf "0011" ;;       
   "4" )  
     printf "0100" ;;  
   "5" )  
     printf "0101" ;;  
   "6" )  
     printf "0110" ;;                  
   "7" )  
     printf "0111" ;;   
   "8" )  
     printf "1000" ;;  
   "9" )  
     printf "1001" ;;  
   "a" )  
     printf "1010" ;;  
   "b" )  
     printf "1011" ;;       
   "c" )  
     printf "1100" ;;  
   "d" )  
     printf "1101" ;;  
   "e" )  
     printf "1110" ;;   
   *)   
     printf "1111" ;;   
  esac  
 }  
 xor()   
 {  
      if (( $1 ^ $2 )) ;then  
           printf "1"  
      else  
           printf "0"  
      fi  
 }  
 bashXORbinstring()  
 {  
 # Take a string, such as arguments 1, 2:  
 # 10100001  
 # 10100000  
 # and return the XOR result  
 STRBIN1=$1  
 STRBIN2=$2  
 if [ ${#STRBIN1} -eq ${#STRBIN2} ]; then  
   STRSIZE=${#STRBIN1} #the string length of the argument  
   for ((COUNTER1=0; COUNTER1 < STRSIZE ; COUNTER1++))  
   do  
    xor ${STRBIN1:$COUNTER1:1} ${STRBIN2:$COUNTER1:1}  
   done   
 else  
  echo "ERROR, XOR failed due to different lengths $STRBIN1, $STRBIN2"   
 fi  
 }  

 CMDRESULT=549b93563bfa04fb
 # at this point, CMDRESULT should have a key, such as:  
 # 549b93563bfa04fb  
 #  
 # now need to split the key into two.  
 STRSIZE=${#CMDRESULT}   
 STRHALFSIZE=$(($STRSIZE / 2)) #divide by two  
 #now use BASH to split the string  
 #echo $CMDRESULT  
 XORARG1=${CMDRESULT:0:$STRHALFSIZE}  
 XORARG2=${CMDRESULT:$STRHALFSIZE:STRHALFSIZE}  
 #echo $XORARG1  
 #echo $XORARG2  
 #convert the strings into binary as a string  
 BINARG1=$(bashhex2bin $XORARG1)  
 BINARG2=$(bashhex2bin $XORARG2)  
 #use the XOR function to XOR the ASCII strings  
 RESULTXOR=$(bashXORbinstring $BINARG1 $BINARG2)  
 echo $BINARG1  
 echo $BINARG2  
 echo $RESULTXOR  

Friday, November 11, 2016

Referencing the RFID Gen2 document via BibTeX

One would not think that it would be difficult to reference a document in BibTeX, but there's strangeness when you don't do it just right. I found this link on referencing the CD4007 via bibtex. In the same vein, I came up with:

\usepackage{url} %for the _ in the URL

@misc{EPCglobalGen2-2013,
  author={EPCglobal Inc.},
  title={{EPC}$^{TM}$  {Radio-Frequency Identity Protocols
Generation-2 UHF RFID}},
  howpublished = "\url{http://www.gs1.org/sites/default/files/docs/epc/uhfc1g2_2_0_0_standard_20131101.pdf}",
  publisher={EPCglobal Inc.},
  year={2013}
}
The {} around the author make sure that it doesn't become E. Inc. The resulting render:

Tuesday, November 8, 2016

Merge PDFs with MacOS and the command line.

I use the command line to merge PDFs all of the time, but I have found that with every MacOS release, things move. I made a script, PDFconcatenator.sh, that finds the script join.py in /System/Library and then passes arguments to join.py. join.py seems to move with every MacOS release and this script works as long as you have join.py on the system.

Ad example of three files:
PDFconcatenator.sh -o merged.pdf ../../file1..pdf file3pdf /off/root/3.pdf
#!/bin/bash
#Before anything else, set the PATH_SCRIPT variable
    pushd `dirname $0` > /dev/null; PATH_SCRIPT=`pwd -P`; popd > /dev/null
    PROGNAME=${0##*/}; PROGVERSION=0.1.0
# WHAT DOES THIS DO?
# This script looks at MacOS distribution and tries to find the python script to merge
# pdfs files. It tends to move depending on MacOS releases.

HUNT_DIR="/System/Library/"

usage(){
    echo "$PROGNAME"
    echo "This program finds the PDF concatenation script on MacOS "
    echo "example:"
    echo "$PROGNAME -o PATH/TO/YOUR/MERGED/FILE.pdf /PATH/TO/1.pdf /PATH/TO/2.pdf /3.pdf"
    echo ""
}

# lowercase makes things lowercase. This is an issue because sometime different OS
# have different conventions. bsd and BSD or FreeBSD and freebsd
lowercase(){
    echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}

# This is my canned script to determine the OS
#
getOS(){
OS=`lowercase \`uname\``
KERNEL=`uname -r`
MACH=`uname -m`

if [ "${OS}" = "windowsnt" ]; then
    OS=windows
elif [ "${OS}" = "darwin" ]; then
    OS=mac
else
    OS=`uname`
    if [ "${OS}" = "SunOS" ] ; then
OS=Solaris
ARCH=`uname -p`
OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
    elif [ "${OS}" = "AIX" ] ; then
OSSTR="${OS} `oslevel` (`oslevel -r`)"
    elif [ "${OS}" = "Linux" ] ; then
if [ -f /etc/redhat-release ] ; then
DistroBasedOn='RedHat'
DIST=`cat /etc/redhat-release |sed s/\ release.*//`
PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/SuSE-release ] ; then
DistroBasedOn='SuSe'
PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
elif [ -f /etc/mandrake-release ] ; then
DistroBasedOn='Mandrake'
PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/debian_version ] ; then
DistroBasedOn='Debian'
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
fi
if [ -f /etc/UnitedLinux-release ] ; then
DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
fi
OS=`lowercase $OS`
DistroBasedOn=`lowercase $DistroBasedOn`
readonly OS
readonly DIST
readonly DistroBasedOn
readonly PSUEDONAME
readonly REV
readonly KERNEL
readonly MACH
fi
fi
}

# start by getting the OS to be sure we can run
getOS

if [ "mac" != "$OS" ]; then
    echo "This script only works on MacOS"
    exit 1
fi

SCRIPT=$(find $HUNT_DIR -name join.py 2>/dev/null)
SCRIPT=$( echo "$SCRIPT" | sed 's/ /\\ /g')

if [ "$#" -eq 0 ]; then
    usage
    exit 2
fi

#run the concatenation
echo "Executing the following command:"
echo "$SCRIPT $@"
#execute the actual command
eval "$SCRIPT $@"


Tuesday, October 4, 2016

Brief: On the design of solid state hard drives

The Solid State Drive (SSD) is a non-volatile storage device that shares a similar function to a traditional hard drive; however, the SSD architecture relies on a FLASH-type storage over a magnetic storage. This note is an executive summary of SSD architecture and throughput.

Introduction

The Solid State Drive (SSD) is a semiconductor-based replacement for the traditional hard drive. The traditional hard drive is bounded by a physical medium of spinning magnetic platters, and this is an example of physically constrained system. As an example, the hard drive is limited by the speed of the platters, the bounds on the head movement and the track width. The SSD is an electrically constrained system and examples of these limits the oxide thickness of a floating- gate transistor, and number of write cycles. SSDs mirror the functionality of hard drives.

Fig. 1. The illustration shows the basic architecture of a SSD. The major components are the cache, controller and FLASH storage. The major routes of communication are by the IO bus, the cache bus and the FLASH bus. The IO bus is connected between a computer interface and the controller, where the purpose of the controller is to mimic the behavior of a storage device and control the writes and reads. The controller also schedules writes between the DRAM cache and FLASH.

The SSD device

The SSD is a device that mimics the traditional hard drive in behavior, but uses solid-state semiconductor components instead of a mechanical medium. The SSD as a system is illustrated in Figure 1, and the device contains a controller and two types of storage, volatile and non-volatile. The purpose of the controller is to mimic the behavior of a hard drive and control writes. The non-volatile storage is the FLASH transistors from where solid state drives get their name. The volatile storage is a cache for temporary storage of data.

Table. 1. Different interface speeds.

Bounding SSD Performance

The SSD is created from several NAND FLASH ICs. As an individual device, the NAND FLASH perform differently be- tween generations; however, this performance can be masked by use of DRAM cache. The NAND in “NAND FLASH” refers to the addressing architecture and the FLASH term refers to the charge storage technique. The threshold of the FLASH MOSFET will shift depending on the charge that is trapped on the gate. The NAND FLASH is arranged in pages and reading and writing is based on this granularity [1]–[3]. Due to the abstraction away from the FLASH performance due to the DRAM cache, the write time of a packaged device is more of an academic exercise, and each 8k bank completes a write in 0.33ms to 0.45ms. The difference in these numbers is the difference between 50MB/sec and 33MB/sec; however, this is also abstracted away by local cache on the FLASH ICs, and possibly the controller. The slower write speed is preferred for endurance. [4], [5]. The bus speed of these devices will remain at approximately 20ns (50MHz) with current interconnect technologies with writes on the order of 200us and “erasing” on the order of 2ms. Bank reads are limited by IO, and thereby are bus limited. Due to the thin oxide and the tunneling process, even if the density of the devices increases, I do not believe that the speed of writing or erasing will increase due to the physics of quantum transport. The only increases that will be seen is interconnect and concurrent writes.

References

[1] A. Goda and K. Parat, “Scaling directions for 2d and 3d nand cells,” in 2012 International Electron Devices Meeting, 2012.
[2] H.-T. Lue, P.-Y. Du, W.-C. Chen, T.-H. Yeh, K.-P. Chang, Y.-H. Hsiao, Y.-H. Shih, C.-H. Hung, and C.-Y. Lu, “A novel dual-channel 3d nand flash featuring both n-channel and p-channel nand characteristics for bit- alterable flash memory and a new opportunity in sensing the stored charge in the wl space,” in 2013 IEEE International Electron Devices Meeting. IEEE, 2013, pp. 3–7. 2
[3] S.-H. Chen, H.-T. Lue, Y.-H. Shih, C.-F. Chen, T.-H. Hsu, Y.-R. Chen, Y.- H. Hsiao, S.-C. Huang, K.-P. Chang, C.-C. Hsieh et al., “A highly scalable 8-layer vertical gate 3d nand with split-page bit line layout and efficient binary-sum milc (minimal incremental layer cost) staircase contacts,” in Electron Devices Meeting (IEDM), 2012 IEEE International. IEEE, 2012, pp. 2–3.
[4] K.-T. Park, S. Nam, D. Kim, P. Kwak, D. Lee, Y.-H. Choi, M.-H. Choi, D.-H. Kwak, D.-H. Kim, M.-S. Kim et al., “Three-dimensional 128 gb mlc vertical nand flash memory with 24-wl stacked layers and 50 mb/s high-speed programming,” IEEE Journal of Solid-State Circuits, vol. 50, no. 1, pp. 204–213, 2015.
[5] W. Kim, J. Y. Seo, Y. Kim, S. H. Park, S. H. Lee, M. H. Baek, J.-H. Lee, and B.-G. Park, “Channel-stacked nand flash memory with layer selection by multi-level operation (lsm),” in 2013 IEEE International Electron Devices Meeting. IEEE, 2013, pp. 3–8.

Wednesday, September 28, 2016

The wonderful 3A1

Most people are familiar with Amazon. Jeff Bezos' Amazon has played a major roll in the growth of e-commerce, and brought us products such as AWS, the Kindle and the Echo. However, I believe that the most utilitarian and overlooked item sold from Amazon is the 3A1.

Amazon 3A1

The Amazon 3A1 is a fully featured device that is appropriate for the younger members of your family, and this is a strong differentiator in the age of technology. The 3A1 is larger than the competitors; however, at 31" x 20.5" x 10.5", the extra space is something that you'll learn to love. The 3A1 comes from the factory with emotionally pleasing bubble wrap, and often other stuff that I cannot currently recall. The bubble wrap is the critical to the user experience of the 3A1. A picture of the 3A1 in action:

Come on Jeff, let's make this happen

A person cannot just own one 3A1. There are just too many appropriate uses. I believe that this superior Amazon product should be available through a subscription model. It is worth the money. Come on Jeff, let's make this happen.

Tuesday, September 20, 2016

SIMON and SPECK Ciphers, where they got their name.

I had the pleasure of talking with Doug Shors at a conference. I asked him about the origin of the SIMON and SPECK name for the ciphers. His answered that "simon" is from Dr. Seuss and "speck" is because he likes bacon. There you have it.

Wednesday, September 7, 2016

Acronym list for cryptography.

I have an issue with acronyms, and simple descriptions. Everyone is correct in all statements but you need to understand their assumption set. I have found that cryptographers are particularly fond of acronyms, to the point that I am unsure if they know what they are talking about. You get sentences such as "CBC requires an unpredictable IV".
Acronym Meaning Example
IV Initialization Vector You often see this in relashionship to one-way hash functions.
ECB Electronic Code Book For block ciphers, when a stream is divided into blocks and each block is encrypted separately.
CBC Cipher Block Chaining Like ECB for block ciphers, but each block is XOR'd with the previous block before encryption.
CTR Counter Counter Mode turns a block cipher into a stream cipher by adding a counter to the blocks in a stream sequence.
AEAD Authenticated Encryption with Associated Data Block cipher mode (based on CTR) that creates an output and an authentication tag.
SIV Synthetic Initialization Vector A vector based on a dependency sequence, the best description is this paper.
ARX Logic Design A structure of cipher based on Additions (a ∧ b), Rotations (a >> i), and XORx (a ⊕ b).
I will add more to this list as I get frustrated with them.

Saturday, August 6, 2016

I created a table from /dev/random, /dev/urandom and a time trend. The time trend was to confirm that random behavior of /dev/urandom and /dev/random were indeed random by picking a random number and then incrementing it to create an upward trend.

index /dev/random trend random /dev/urandom trend urandom
1 3090913448 3093559761 1146094747 1148741060
2 1725384933 1730677559 2272041705 2277334331
3 2519982800 2527921739 672398708 680337647
4 4122969282 4133554534 3573000125 3583585377
5 829870557 843102122 3890184886 3903416451
6 1137466054 1153343932 3033196081 3049073959
7 1749860515 1768384706 289899107 308423298
8 1086191125 1107361629 2583955473 2605125977
9 2960121018 2983937835 2044022238 2067839055
10 1391878942 1418342072 3912550192 3939013322
11 2341971286 2371080729 3236438696 3265548139
12 1705867838 1737623594 132825467 164581223
13 753914462 788316531 304667943 339070012
14 3508276657 3545325039 2915100256 2952148638
15 1875191105 1914885800 1012669187 1052363882
16 3703457764 3745798772 3452319568 3494660576
17 354771931 399759252 2873521363 2918508684
18 1440622486 1488256120 3077894758 3125528392
19 95590728 145870675 954438133 1004718080
20 1494851198 1547777458 617444881 670371141
21 3463282696 3518855269 1210761559 1266334132
22 2763078310 2821297196 1551406163 1609625049
23 845299620 906164819 3649401839 3710267038
24 1700972881 1764484393 1089683906 1153195418
25 955272830 1021430655 3982767222 4048925047
26 650720476 719524614 971589845 1040393983
27 3287043751 3358494202 3145132743 3216583194
28 1908951424 1983048188 4215965221 4290061985
29 470755280 547498357 627089318 703832395
30 3831082648 3910472038 1101883066 1181272456
31 71926512 153962215 4005292614 4087328317
32 1105700659 1190382675 3320547984 3405230000
33 2350999734 2438328063 2915198482 3002526811
34 60380453 150355095 2014112616 2104087258
35 1040967499 1133588454 734403762 827024717
36 351870294 447137562 1205264218 1300531486
37 1390463641 1488377222 194203856 292117437
38 2930925789 3031485683 3238614567 3339174461
39 53665085 156871292 1425212007 1528418214
40 3215787494 3321640014 3694264521 3800117041
41 3367283152 3475781985 1902890120 2011388953
42 3187584017 3298729163 933685552 1044830698
43 1859788408 1973579867 1711326701 1825118160
44 1054803870 1171241642 3457011070 3573448842
45 2360444578 2479528663 1051693432 1170777517
46 3811363929 3933094327 2956558631 3078289029
47 1011729055 1136105766 1212604488 1336981199
48 3643401256 3770424280 1244477930 1371500954
49 3115115165 3244784502 2846283813 2975953150
50 656115332 788430982 2591892426 2724208076
51 2082787750 2217749713 2651238877 2786200840
52 3110320829 3247929105 2729262093 2866870369
53 753082727 893337316 3466011077 3606265666
54 2911477629 3054378531 714762268 857663170
55 3787367806 3932915021 3355974321 3501521536
56 1589750894 1737944422 624948913 773142441
57 4155645711 4306485552 3577805429 3728645270
58 1816595958 1970082112 1639866852 1793353006
59 2481584779 2637717246 16909395 173041862
60 4132149189 4290927969 3652892113 3811670893
61 1598933723 1760358816 2197834849 2359259942
62 3744374840 3908446246 2088693600 2252765006
63 2053368070 2220085789 3178914513 3345632232
64 3301704446 3471068478 2880564908 3049928940
65 2185631082 2357641427 3420597153 3592607498
66 3832147979 4006804637 113709751 288366409
67 2362338048 2539641019 1611188583 1788491554
68 302586833 482536117 3853880993 4033830277
69 1859359559 2041955156 2102925372 2285520969
70 2595404044 2780645954 2341954598 2527196508
71 2993709235 3181597458 2122271498 2310159721
72 3833863061 4024397597 1407393014 1597927550
73 3150310233 3343491082 451722778 644903627
74 180901532 376728694 739693901 935521063
75 2202712885 2401186360 3748596151 3947069626
76 250732140 451851928 3793176280 3994296068
77 2972237033 3176003134 1475646375 1679412476
78 1878442067 2084854481 4092325325 4298737739
79 1009851020 1218909747 4127235886 4336294613
80 974318580 1186023620 3741001624 3952706664
81 2019291070 2233642423 835040996 1049392349
82 299298648 516296314 669288129 886285795
83 427571604 647215583 2180665975 2400309954
84 2338337598 2560627890 493610159 715900451
85 3937148072 4162084677 33862552 258799157
86 3091053649 3318636567 2019279108 2246862026
87 2750818025 2981047256 3201562413 3431791644
88 2018951173 2251826717 1701584444 1934459988
89 872900948 1108422805 63116109 298637966
90 265806730 503974900 1160493344 1398661514
91 1043275026 1284089509 3599575440 3840389923
92 1376193275 1619654071 324303775 567764571
93 482211967 728319076 3009784414 3255891523
94 960682921 1209436343 942803081 1191556503
95 2361449773 2612849508 137251334 388651069
96 1353503034 1607549082 2377967043 2632013091
97 3673165482 3929857843 1791508587 2048200948
98 2962520613 3221859287 3023302955 3282641629
99 653473584 915458571 3790293488 4052278475
100 1534899190 1799530490 2149654832 2414286132

Thursday, July 28, 2016

Arabic numbers.

I have to say that I thought this concept was terrible funny. Enough so that I hazarded a go at art.
I love arabic numbers.

Saturday, June 18, 2016

TeX capacity exceeded, sorry [main memory size=5000000]

LaTeX is a weird bird. I ran out of memory. The solution: add the line "main_memory = 8000000" to the file /usr/local/texlive/2015/texmf.cnf
$ sudo fmtutil-sys --all
It's worth noting that 8000000 seems to be the maximum value.

Friday, June 17, 2016

\strip@pt undefined in LaTeX, and the fix.

I could not get the statement \strip@pt in LaTeX to parse. It would always just give an undefined value. The solution is to change context, which is such as hack, but that's how you do it.
\documentclass[journal,letterpaper]{IEEEtran}
\usepackage{fp}     

\begin{document}
\newcommand\bitfieldwidth{32}  
\newcommand\bitfielddivision{8}
\makeatletter
\FPeval{\bitcolumnwidth}{(\strip@pt\textwidth) / \bitfieldwidth}
\makeatother

\begin{tabular}{|c|c|}
\hline
variable & value \\
\hline
textwidth &\the\textwidth \\
\hline
columnwidth &\the\columnwidth \\
\hline
bitcolumnwidth &$\bitcolumnwidth$ \\
\hline
\end{tabular}

\end{document}
The rendered table is:

Thursday, May 26, 2016

On the temperature dependence of subthreshold currents in MOS electron inversion layers, revisited

I presented a paper, on a paper: On the temperature dependence of subthreshold currents in MOS electron inversion layers. Yannis Tsividis even came to my talk at ISCAS 2016 and he told me that he took the data that Ulmer and Card used!

CMOS processes have become much better, and self-aligned CMOS have really helped MOSFET behavior become amazingly well behaved. The MATLAB that was used to extract and analyze the data is available here: http://www.nectix.com/research/subvt-temperature.html

Tuesday, May 10, 2016

Reverse engineering a RFID tag

I've been designing a RFID tag from scratch. It's mainly because what I want cannot be purchased. My tutorial from IEEE RFID 2016 is now on my georgia tech research page research page. Next year I think that I'll split it into a very technical talk, and a more touchy-feely demonstration and introduction talk.

Saturday, February 13, 2016

I like art, I'm just bad at it.

I love the arts because I am not good at them. Semiconductors is a better core competency for me than music ever could be. I saw that Ken Barnes was trying to raise money for a movie that is a mixture of Vertigo and Body Heat.

The Origami Man seems like it would be really cool if he can get it off the ground.

The Origami Man Movie Teaser from Ken Barnes on Vimeo.

Tuesday, January 26, 2016

After some tweaking...

As per my last post where I was trying to optimize my kernel for Linux. I tried and have Cadence working on FreeBSD with linux binary compatibility. Also, the times from my arbitrary program to compare speed showed:
native, 15.2.0 Darwin: 643 seconds
emulated 1CPU, linux-3.2.0: 1112 seconds 
emulated 1CPU, FreeBSD 11: 669 seconds
I made some tweaks to MacOS as well, so my arbitrary result is that FreeBSD is much faster than Linux under emulation.

Monday, January 25, 2016

Optimal Linux Kernel for a VirtualBox

I do math. I do a lot of math. Between semiconductor simulations, and custom software, I care only about how many hours/days I can speed things up. I still use my Pismo (603e, 1GiB) occasionally because certain long multiplies are still faster than on my spiffy new i7 because I can cache lock, and other tricks (in full disclosure, x86 is the architecture that I care the least about because the ISA is terrible, but you have to applaud Intel for almost 40 years of binary compatibility and Microsoft for Windows upgrading so well for so long)

Problem: I upgraded to MacOS 10.11 from 10.9, and it broke things.
Solution: Upgrade software to make it work again.
What I first noticed with VirtualBox, after the upgrade to 10.11, was that some of my cmos14soi work took 8hrs to validate instead of 1. They paradigm when from "go make coffee" to go to bed. At this point, I had nothing but regret, but you need to live in the moment. I cannot downgrade to 10.9, so I just have to make what I have work better, thus:

Time to figure out the optimal virtualbox linux kernel
As currently, there is an 8x increase in time over my previous setup, and I'm about to start a new IC, I want to be sure that I optimize my time, even if it takes all day. Firstly, I wanted something quantitative to see what the difference would be, so went looking for a speed test suite. I created a file that loops through all simon 32/64 values for a random key: main.quick.c. (In the same repository is main.c, but you don't want to use it. It acts like SPICE does with file writes, but it takes days to run.) Compiling main.quick.c by "cc main.quick.c -o quick", the results where as follows for my 2.8 GHz Intel Core i7 Macbook Pro with 16GiB RAM
native, 15.2.0 Darwin: 844 seconds
emulated 2CPU, linux-3.2.0: 1131seconds 
emulated 1CPU, linux-3.2.0: 1119 seconds 
My virtualbox settings I'm sure were default, except I use 10GiB of RAM for the VM. If you think about this, it would make sense that a minimal, non-SMP kernel is the way to go with Linux under emulation, so I will use that. Go into virtual box and select 1 processor, turn off sound. Now to make the kernel. I happen to be using Debian, and I read a lot of documentation.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git fakeroot build-essential libncurses-dev xz-utils libssl-dev bc wget
The next thing to do is install the kernel package.
$ sudo apt-get install kernel-package
Why this package requires libmail-sendmail-perl, I will never know.
Now to get the most recent kernel, which I put in /usr/src/. I am going to rebuild the kernel that I have because I do not want to break any of my tools.
$ cd /usr/src
$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.76.tar.xz
I jest, but the last kernel that I compiled was 2.0.38. That was 1996 and I moved to BSD. I prefer BSD, but my tools require Linux and a license. I decided to use the 3.2.x kernel because my toolkits already use 3.2.1 and I have some modules that are specific to my tools.
Once the kernel arrives, you need to unpack it and enter the top directory.
$ tar xvf linux-3.2.76.tar.xz && cd linux-3.2.76
Now we are to the building the kernel part. It's choose your own adventure! You can either build your own, or use the configuration file that I used. If you want to build your kernel with options you specify yourself, type:
$ make menuconfig
If you want to just use my configuration, you need the .config file.
$ wget https://raw.githubusercontent.com/bpdegnan/simonsays/master/config-3.2.76
The .config file is just what the result of what is created my "menuconfig".
Now we are to the part that is "Debian-style". We are going to make the kernel as a package. Building the kernel will take awhile.
$ make-kpkg clean
$ fakeroot make-kpkg --initrd --revision=1.0.VBOX kernel_image kernel_headers
At this point, the package is built. If you put your source in /usr/src, you will find to .deb files in the directory. The first is the linux-headers- and the next is the linux-image- You then need to install these, as they are your new kernel and headers.
$ sudo dpkg -i *.deb
Using the dpkg tool to install the kernel also updates the bootloader.

So here's the kicker. The new kernel is much slower than the previous one.
emulated 1CPU, linux-3.2.76: 1127 seconds 
I will have to dig deeper into this when I get a chance.