]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
even smaller
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Tue, 11 May 2010 09:52:08 +0000 (09:52 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Tue, 11 May 2010 09:52:08 +0000 (09:52 +0000)
bmw/bmw_small-tinyasm.S
host/data2wiki.rb

index 38a2a21f45886219592d1f45b02158049af4eacf..f3da54432c17be630ea7af86182021a50ade088a 100644 (file)
@@ -774,18 +774,10 @@ f2:
 27:    rcall shiftright32
 28:    rcall eor32_to_acc
 ;---
-       ld r0, X
-       eor r0, acc0
-       st X+, r0
-       ld r0, X
-       eor r0, acc1
-       st X+, r0
-       ld r0, X
-       eor r0, acc2
-       st X+, r0
-       ld r0, X
-       eor r0, acc3
-       st X+, r0
+       rcall load32_from_X
+       rcall eor32_to_acc
+       rcall store_acc_to_dec_X
+       adiw r26, 4
 ;---
        dec r17
        brne 10b
index 3791b496e17ff82d09dc767990e1a22e7da5b58b..d5c74444f2b9f72e201245f58d82dcc06fd46022 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/ruby
-# performance to wiki
+# performnce to wiki
 
 =begin
     This file is part of the AVR-Crypto-Lib.
@@ -41,7 +41,7 @@ def get_size_string(impl, algo)
   while l=fmap.gets
     if m=l.match(/^([^:]*):(.*)$/)
       if m[1] == algo
-        modules = m[2].split(' ')
+        modules = m[2].split(/[\s]+/)
       end
     end
   end
@@ -73,43 +73,47 @@ def process_hashfunction(fin, name, impl)
   end
   hashsize = m[1].to_i()
   lb = fin.readline()
-  m = lb.match(/ctxsize \(bytes\):[\s]*([\d]*)/)
+  m = lb.match(/ctxsize \(bytes\):[\s]*([\d]+)/)
   ctxsize = m[1].to_i()
   lb = fin.readline()
-  m = lb.match(/blocksize \(bits\):[\s]*([\d]*)/)
+  m = lb.match(/blocksize \(bits\):[\s]*([\d]+)/)
   blocksize = m[1].to_i()
   lb = fin.readline()
-  m = lb.match(/init \(cycles\):[\s]*([\d]*)/)
+  m = lb.match(/init \(cycles\):[\s]*([\d]+)/)
   inittime = m[1].to_i()
   lb = fin.readline()
-  m = lb.match(/nextBlock \(cycles\):[\s]*([\d]*)/)
+  m = lb.match(/nextBlock \(cycles\):[\s]*([\d]+)/)
   nextblocktime = m[1].to_i()  
   lb = fin.readline()
-  m = lb.match(/lastBlock \(cycles\):[\s]*([\d]*)/)
+  m = lb.match(/lastBlock \(cycles\):[\s]*([\d]+)/)
   lastblocktime = m[1].to_i()
   lb = fin.readline()
-  m = lb.match(/ctx2hash \(cycles\):[\s]*([\d]*)/)
+  m = lb.match(/ctx2hash \(cycles\):[\s]*([\d]+)/)
   convtime = m[1].to_i()
   begin
+    lb = fin.gets()
+  end until lb==nil || m = lb.match(/init \(bytes\):[\s]*([\d]*)/)
+  if lb
+    initstack = m[1].to_i()
     lb = fin.readline()
-  end until m = lb.match(/init \(bytes\):[\s]*([\d]*)/)
-  initstack = m[1].to_i()
-  lb = fin.readline()
-  m = lb.match(/nextBlock \(bytes\):[\s]*([\d]*)/)
-  nextblockstack = m[1].to_i()
-  lb = fin.readline()
-  m = lb.match(/lastBlock \(bytes\):[\s]*([\d]*)/)
-  lastblockstack = m[1].to_i()
-  lb = fin.readline()
-  m = lb.match(/ctx2hash \(bytes\):[\s]*([\d]*)/)
-  convstack = m[1].to_i()
-  s1 = (initstack>nextblockstack)?initstack:nextblockstack
-  s2 = (lastblockstack>convstack)?lastblockstack:convstack
-  stack = (s1>s2)?s1:s2  
+    m = lb.match(/nextBlock \(bytes\):[\s]*([\d]*)/)
+    nextblockstack = m[1].to_i()
+    lb = fin.readline()
+    m = lb.match(/lastBlock \(bytes\):[\s]*([\d]*)/)
+    lastblockstack = m[1].to_i()
+    lb = fin.readline()
+    m = lb.match(/ctx2hash \(bytes\):[\s]*([\d]*)/)
+    convstack = m[1].to_i()
+    s1 = (initstack>nextblockstack)?initstack:nextblockstack
+    s2 = (lastblockstack>convstack)?lastblockstack:convstack
+    stack = (s1>s2)?s1:s2  
+  else
+    stack = 0
+  end  
   size = get_size_string(impl, name)
-  printf("| %20s || %3s || %3s || %6d || %7d || %7d || %7d || %7d ||" +
+  printf("| %20s || %6s || %3s || %6d || %7d || %7d || %7d || %7d ||" +
          " %7d || %7d || %9.2f || %7d || || || \n|-\n" , 
-        name, $lang, $lang, size, ctxsize, stack, hashsize, blocksize, 
+        name, $variant, $lang, size, ctxsize, stack, hashsize, blocksize, 
            inittime, nextblocktime, nextblocktime.to_f/(blocksize/8),
                lastblocktime+convtime)
 end
@@ -121,9 +125,16 @@ $handlers["hashfunction"] = 1 #process_hashfunction
 
 def process_file(fname)
   fin = File.open(fname, "r")
-  $lang = "asm"
-  $lang = "C" if fname.match(/_c.txt$/)
   impl = fname.match(/([^.]*).txt$/)[1]
+  $lang = "asm"
+  $lang = "C" if impl.match(/^[^_]*_[cC]/)
+  $variant = $lang
+  if m=impl.match(/_([^_]*)$/)
+    $variant = m[1]
+  end
+  if $variant == 'c'
+    $variant = 'C'
+  end
   begin
     begin
          if fin.eof()
@@ -137,6 +148,7 @@ def process_file(fname)
     type = m[1]
     if $handlers[type] != 0
     #  handlers[type](fin, name)
+    #  puts "DBG: process "fname+'-'+name+'-'+impl
       process_hashfunction(fin, name, impl)
     else
       printf("ERROR: unsupported type: %s !\n", type)