Use backtick code blocks for syntax highlighting
This commit is contained in:
parent
8ed9dea394
commit
f658bfbb40
203 changed files with 26546 additions and 25801 deletions
44
04-07.md
44
04-07.md
|
|
@ -28,17 +28,19 @@ request a memory access from the Bus Interface Unit.)
|
|||
|
||||
**LISTING 4.9 LST4-9.ASM**
|
||||
|
||||
; Measures the performance of repeated MUL instructions,
|
||||
; which allow the prefetch queue to be full at all times,
|
||||
; to demonstrate a case in which DRAM refresh has no impact
|
||||
; on code performance.
|
||||
;
|
||||
sub ax,ax
|
||||
call ZTimerOn
|
||||
rept 1000
|
||||
mul ax
|
||||
endm
|
||||
call ZTimerOff
|
||||
```nasm
|
||||
; Measures the performance of repeated MUL instructions,
|
||||
; which allow the prefetch queue to be full at all times,
|
||||
; to demonstrate a case in which DRAM refresh has no impact
|
||||
; on code performance.
|
||||
;
|
||||
sub ax,ax
|
||||
call ZTimerOn
|
||||
rept 1000
|
||||
mul ax
|
||||
endm
|
||||
call ZTimerOff
|
||||
```
|
||||
|
||||
Running Listing 4.9, we find that each **MUL** executes in 24.72 µs, or
|
||||
exactly 118 cycles. Since that's the shortest time in which **MUL** can
|
||||
|
|
@ -56,15 +58,17 @@ to fetch the instruction bytes.
|
|||
|
||||
**LISTING 4.10 LST4-10.ASM**
|
||||
|
||||
; Measures the performance of repeated SHR instructions,
|
||||
; which empty the prefetch queue, to demonstrate the
|
||||
; worst-case impact of DRAM refresh on code performance.
|
||||
;
|
||||
call ZTimerOn
|
||||
rept 1000
|
||||
shr ax,1
|
||||
endm
|
||||
call ZTimerOff
|
||||
```nasm
|
||||
; Measures the performance of repeated SHR instructions,
|
||||
; which empty the prefetch queue, to demonstrate the
|
||||
; worst-case impact of DRAM refresh on code performance.
|
||||
;
|
||||
call ZTimerOn
|
||||
rept 1000
|
||||
shr ax,1
|
||||
endm
|
||||
call ZTimerOff
|
||||
```
|
||||
|
||||
Since 4 cycles are required to read each instruction byte, we'd expect
|
||||
each **SHR** to execute in 8 cycles, or 1.676 µs, if there were no DRAM
|
||||
|
|
|
|||
Loading…
Reference in a new issue