further shrinked BMW224/256 to 1884 bytes

This commit is contained in:
bg 2010-04-12 11:02:38 +00:00
parent 7bc75db2cf
commit 82de0ec79b
2 changed files with 35 additions and 19 deletions

View File

@ -419,7 +419,7 @@ expand1:
*/ */
expand2_rot_table: expand2_rot_table:
.byte 0,3,0,7,0,13,0,16,0,19,0,23,0,27 .byte 3,7,13,16,19,23,27,0
expand2: expand2:
rcall expand_intro rcall expand_intro
@ -428,10 +428,11 @@ expand2:
ldi r31, hi8(expand2_rot_table) ldi r31, hi8(expand2_rot_table)
10: 10:
rcall load32_from_X rcall load32_from_X
mov r20, r19 sbrs r19, 0
rjmp 12f
lpm r20, Z+ lpm r20, Z+
rcall rotateleft32 rcall rotateleft32
rcall add32_to_acc 12: rcall add32_to_acc
dec r19 dec r19
brne 10b brne 10b
ldi r20, 4 ldi r20, 4

View File

@ -34,21 +34,38 @@
6801 32 0 6833 1ab1 bin/bmw_c/bmw_small.o 6801 32 0 6833 1ab1 bin/bmw_c/bmw_small.o
=end =end
def get_size_string(fsize) def get_size_string(impl, algo)
fmap = File.open('algo_implementation/'+impl+'.algos', 'r')
fsize = File.open('size_log/'+impl+'.size', 'r')
modules = nil
while l=fmap.gets
if m=l.match(/^([^:]*):(.*)$/)
if m[1] == algo
modules = m[2].split(' ')
end
end
end
if modules==nil
puts("ERROR: no module list found for #{impl}/#{algo} !")
return nil
end
fmap.close()
str = '' str = ''
sum = 0 sum = 0
lb = fsize.readline() lb = fsize.gets()
loop do while lb = fsize.gets()
return sum.to_s() + str if fsize.eof()
lb = fsize.readline()
m = lb.match(/[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w_\/-]*)/) m = lb.match(/[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w_\/-]*)/)
name = m[6].match(/\/([^\/]*)$/)[1] name = m[6]+'.o'
str += "<br> \n" + name+': '+m[4] if modules.include?(name)
sum += m[4].to_i str += "<br> \n" + name+': '+m[4]
sum += m[4].to_i
end
end end
fsize.close()
return sum
end end
def process_hashfunction(fin, name, fsize) def process_hashfunction(fin, name, impl)
lb = fin.readline() lb = fin.readline()
m = lb.match(/hashsize \(bits\):[\s]*([\d]*)/) m = lb.match(/hashsize \(bits\):[\s]*([\d]*)/)
if(!m) if(!m)
@ -89,9 +106,9 @@ def process_hashfunction(fin, name, fsize)
s1 = (initstack>nextblockstack)?initstack:nextblockstack s1 = (initstack>nextblockstack)?initstack:nextblockstack
s2 = (lastblockstack>convstack)?lastblockstack:convstack s2 = (lastblockstack>convstack)?lastblockstack:convstack
stack = (s1>s2)?s1:s2 stack = (s1>s2)?s1:s2
size = get_size_string(fsize) size = get_size_string(impl, name)
printf("| %20s || %3s || %3s \n| %s \n| %4d || %4d || %4d || %4d ||" + printf("| %20s || %3s || %3s || %6d || %7d || %7d || %7d || %7d ||" +
" %6d || %6d || %7.2f || %6d || || || \n|-\n" , " %7d || %7d || %9.2f || %7d || || || \n|-\n" ,
name, $lang, $lang, size, ctxsize, stack, hashsize, blocksize, name, $lang, $lang, size, ctxsize, stack, hashsize, blocksize,
inittime, nextblocktime, nextblocktime.to_f/(blocksize/8), inittime, nextblocktime, nextblocktime.to_f/(blocksize/8),
lastblocktime+convtime) lastblocktime+convtime)
@ -106,9 +123,7 @@ def process_file(fname)
fin = File.open(fname, "r") fin = File.open(fname, "r")
$lang = "asm" $lang = "asm"
$lang = "C" if fname.match(/_c.txt$/) $lang = "C" if fname.match(/_c.txt$/)
algo = fname.match(/.([^.]*).txt$/)[1] impl = fname.match(/([^.]*).txt$/)[1]
size_filename = 'size_log/'+algo+'.size'
fsize = File.open(size_filename, "r")
begin begin
begin begin
if fin.eof() if fin.eof()
@ -122,7 +137,7 @@ def process_file(fname)
type = m[1] type = m[1]
if $handlers[type] != 0 if $handlers[type] != 0
# handlers[type](fin, name) # handlers[type](fin, name)
process_hashfunction(fin, name, fsize) process_hashfunction(fin, name, impl)
else else
printf("ERROR: unsupported type: %s !\n", type) printf("ERROR: unsupported type: %s !\n", type)
end end