New sample program.
This commit is contained in:
@@ -5,12 +5,12 @@ HARPDIS = ../harptool -D
|
|||||||
4BARCH = 4b16/16/2
|
4BARCH = 4b16/16/2
|
||||||
|
|
||||||
all: simple.bin sieve.bin 2thread.bin simple.4b.bin sieve.4b.bin 2thread.4b.bin bubble.bin bubble.4b.bin dotprod.bin dotprod.4b.bin matmul.bin matmul.4b.bin \
|
all: simple.bin sieve.bin 2thread.bin simple.4b.bin sieve.4b.bin 2thread.4b.bin bubble.bin bubble.4b.bin dotprod.bin dotprod.4b.bin matmul.bin matmul.4b.bin \
|
||||||
matmul-mt.s
|
matmul-mt.s lfsr.bin
|
||||||
|
|
||||||
run: simple.out sieve.out 2thread.out simple.4b.out sieve.4b.out 2thread.4b.out bubble.out bubble.4b.out dotprod.out dotprod.4b.out matmul.out matmul.4b.out\
|
run: simple.out sieve.out 2thread.out simple.4b.out sieve.4b.out 2thread.4b.out bubble.out bubble.4b.out dotprod.out dotprod.4b.out matmul.out matmul.4b.out\
|
||||||
matmul-mt.out
|
matmul-mt.out lfsr.4b.out lfsr.out
|
||||||
|
|
||||||
disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d bubble.4b.d dotprod.d dotprod.4b.d matmul.d matmul.4b.d matmul-mt.d
|
disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d bubble.4b.d dotprod.d dotprod.4b.d matmul.d matmul.4b.d matmul-mt.d lfsr.d
|
||||||
|
|
||||||
%.4b.out : %.4b.bin
|
%.4b.out : %.4b.bin
|
||||||
$(HARPEM) -a $(4BARCH) -c $< > $@
|
$(HARPEM) -a $(4BARCH) -c $< > $@
|
||||||
@@ -36,6 +36,9 @@ simple.bin : boot.HOF lib.HOF simple.HOF
|
|||||||
sieve.bin : boot.HOF lib.HOF sieve.HOF
|
sieve.bin : boot.HOF lib.HOF sieve.HOF
|
||||||
$(HARPLD) -o $@ $^
|
$(HARPLD) -o $@ $^
|
||||||
|
|
||||||
|
lfsr.bin : boot.HOF lib.HOF lfsr.HOF
|
||||||
|
$(HARPLD) -o $@ $^
|
||||||
|
|
||||||
dotprod.bin : boot.HOF lib.HOF dotprod.HOF
|
dotprod.bin : boot.HOF lib.HOF dotprod.HOF
|
||||||
$(HARPLD) -o $@ $^
|
$(HARPLD) -o $@ $^
|
||||||
|
|
||||||
@@ -57,6 +60,9 @@ dotprod.4b.bin : boot.4b.HOF lib.4b.HOF dotprod.4b.HOF
|
|||||||
matmul.4b.bin : boot.4b.HOF lib.4b.HOF matmul.4b.HOF
|
matmul.4b.bin : boot.4b.HOF lib.4b.HOF matmul.4b.HOF
|
||||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||||
|
|
||||||
|
lfsr.4b.bin : boot.4b.HOF lib.4b.HOF lfsr.4b.HOF
|
||||||
|
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||||
|
|
||||||
%.4b.bin : %.4b.HOF
|
%.4b.bin : %.4b.HOF
|
||||||
$(HARPLD) --arch $(4BARCH) -o $@ $<
|
$(HARPLD) --arch $(4BARCH) -o $@ $<
|
||||||
|
|
||||||
|
|||||||
26
src/test/lfsr.s
Normal file
26
src/test/lfsr.s
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
.perm x
|
||||||
|
.entry
|
||||||
|
.global
|
||||||
|
entry: ldi %r0, #0x1234;
|
||||||
|
ldi %r3, #100;
|
||||||
|
|
||||||
|
loop: ori %r7, %r0, #0;
|
||||||
|
jali %r5, printhex
|
||||||
|
jali %r5, lfsr_step
|
||||||
|
|
||||||
|
subi %r3, %r3, #1
|
||||||
|
rtop @p0, %r3
|
||||||
|
@p0 ? jmpi loop
|
||||||
|
|
||||||
|
halt
|
||||||
|
|
||||||
|
/* %r0: value and return value
|
||||||
|
* %r5: return address
|
||||||
|
*/
|
||||||
|
lfsr_step: shri %r1, %r0, #30
|
||||||
|
shri %r2, %r0, #2
|
||||||
|
xor %r1, %r1, %r2
|
||||||
|
andi %r1, %r1, #1
|
||||||
|
shli %r0, %r0, #1
|
||||||
|
or %r0, %r0, %r1
|
||||||
|
jmpr %r5
|
||||||
Reference in New Issue
Block a user