Fix some bugs for real board warumup4

This commit is contained in:
2022-11-21 12:17:43 +01:00
parent 4666ae9bf8
commit e5879022b7
3 changed files with 64 additions and 36 deletions

View File

@@ -12,11 +12,32 @@ nop
scrolling_addr: .word 0x000F00A0
scrolling_count_addr: .word 0x000F00A4
// scrolling_cnt_value: .word 0x0FC000 // for real board
scrolling_cnt_value: .word 0x100 // for simulation
scrolling_cnt_value: .word 0x20FC000 // for real board
// scrolling_cnt_value: .word 0x100 // for simulation
// w_cnt_top: .word 0xFFC000 // for real board
w_cnt_top: .word 0x3000 //for simulation
w_cnt_top: .word 0x3FC000 // for real board
// w_cnt_top: .word 0x100 //for simulation
// pattern1:
// .word 0x01030204
// .word 0x05070608
// .word 0x090B0A0C
// .word 0x0D0F0E00
//
// pattern2:
// .word 0x0F0E0E0B
// .word 0x0D0A0E0D
//
// pattern3:
// .word 0x01
//
// pattern4:
// .word 0x021003
//
// pattern5:
// .word 0x00100010
// .word 0x00100010
// .word 0x00
write_mask:
.word 0x1000000
@@ -148,10 +169,10 @@ number_loop:
st32 r0, r4
// Double scrolling speed
ldr r5, >scrolling_count_addr
ldr r7, >scrolling_cnt_value
rsh r7, r7, 1 // Divide by 2
st32 r5, r7
// ldr r5, >scrolling_count_addr
// ldr r7, >scrolling_cnt_value
// rsh r7, r7, 1 // Divide by 2
// st32 r5, r7
// Clear
clr r4
@@ -160,7 +181,7 @@ number_loop:
// --------- DEAD BEEF ---------
clr r4
addi r4, 0xD
addi r4, 0xF
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
@@ -172,19 +193,7 @@ number_loop:
st32 r0, r4
clr r4
addi r4, 0xA
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
clr r4
addi r4, 0xD
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
clr r4
addi r4, 0x10
addi r4, 0xE
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
@@ -196,7 +205,19 @@ number_loop:
st32 r0, r4
clr r4
addi r4, 0xE
addi r4, 0x10
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
clr r4
addi r4, 0xD
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
clr r4
addi r4, 0xA
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
@@ -208,7 +229,7 @@ number_loop:
st32 r0, r4
clr r4
addi r4, 0xF
addi r4, 0xD
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
@@ -258,13 +279,13 @@ number_loop:
// --------- 2 3 ---------
clr r4
addi r4, 0x2
addi r4, 0x3
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
clr r4
addi r4, 0x3
addi r4, 0x2
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
@@ -300,12 +321,6 @@ number_loop:
or r4, r4, r1
st32 r0, r4
clr r4
addi r4, 0x0
lsh r4, r4, 16
or r4, r4, r1
st32 r0, r4
// Turn on
clr r4
addi r4, 0x1
@@ -314,15 +329,28 @@ number_loop:
call >wait
nop
// Turn off
clr r4
addi r4, 0x1
st32 r0, r4
br always >reset
nop
//subroutine to iterate until counter overflow
wait:
clr r7 //inititalize inner counter
clr r6 // outer counter
clr r9
addi r9, 0x7F
inc_o:
clr r7
inc_i:
cmp neq r7,r8
br true >inc_i //if i=cnt_top
addi r7,1
ret //else
cmp neq r6,r9 // else, if i=cnt_outer
br true >inc_o
addi r6,1 // else
ret
nop

View File

@@ -54,8 +54,8 @@ begin
);
timer: simple_timer
generic map (timer_start => x"00000008") -- for simulation
-- generic map (timer_start => x"00000F00") -- for board
-- generic map (timer_start => x"00000008") -- for simulation
generic map (timer_start => x"00000F00") -- for board
port map(
clk => clk,
rst => rst,

View File

@@ -14,7 +14,7 @@ use work.lt16soc_peripherals.all;
entity lt16soc_top is
generic(
programfilename : string := "../../programs/timer_blinky.ram" -- see "Synthesize XST" process properties for actual value ("-generics" in .xst file)!
programfilename : string := "../../programs/scrolling.ram" -- see "Synthesize XST" process properties for actual value ("-generics" in .xst file)!
);
port(
-- clock signal