Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Verilog HW #8 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. Store the sum in the address 99.

Similar presentations


Presentation on theme: "1 Verilog HW #8 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. Store the sum in the address 99."— Presentation transcript:

1 1 Verilog HW #8 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. Store the sum in the address 99. You can use any instruction used in the lecture slides but try to minimize your instruction set. If you need, you can make your own instruction such as LDC. But, remember that you have to implement it in your CPU eventually. LDC // Load constant number to AC ex) LDC 9 // AC <= 9 Calculate the total cycles to complete the program.

2 과제마감은 11 월 13 일 11 월 10 일에 자신의 어셈블리코드에 대한 발표를 하는 학생은 최대 30 점 보너스. 2

3 function call vs. goto main ( ) { for (i=0; i < 10; i++) add (&sum, score ); printf (“%d”, sum); } add (&sum, score ) { sum = sum + score[i]; } 3 main ( ) { i = 0; loop : sum = sum + score[i]; i = i + 1; if (i != 10) goto loop; printf (“%d”, sum); }

4 add 110 // AC <= AC + mem[110] add [110] // AC <= AC + mem[mem[110]] isz 100 // mem[100]= mem[100]+1 // if mem[100] == 0, skip next instruction, AND 0xxx 8xxxAND memory word to AC ADD 1xxx 9xxxAdd memory word to AC BUN 4xxx CxxxBranch unconditionally BSA 5xxx DxxxBranch and save return address ISZ 6xxx ExxxIncrement and skip if zero SymbolI = 0I = 1Description isz T4 ~ T6 : D 6 T 4 : DR <- M[AR] D 6 T 5 : DR <- DR +1 D 6 T 6 : M[AR] <- DR, if (DR = 0) then PC <- PC +1, SC <- 0


Download ppt "1 Verilog HW #8 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. Store the sum in the address 99."

Similar presentations


Ads by Google