MCPcopy Create free account
hub / github.com/djhworld/simple-computer / TestMemory64KWrite

Function TestMemory64KWrite

memory/memory_test.go:10–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestMemory64KWrite(t *testing.T) {
11 bus := components.NewBus(arch.BUS_WIDTH)
12 m := NewMemory64K(bus)
13
14 var i uint16
15 var q uint16 = 0xFFFF
16 for i = 0x0000; i < 0xFFFF; i++ {
17 m.AddressRegister.Set()
18 bus.SetValue(i)
19 m.Update()
20
21 m.AddressRegister.Unset()
22 m.Update()
23
24 bus.SetValue(q)
25 m.Set()
26 m.Update()
27
28 m.Unset()
29 m.Update()
30
31 q--
32 }
33
34 var expected uint16 = 0xFFFF
35 for i = 0x0000; i < 0xFFFF; i++ {
36 m.AddressRegister.Set()
37 bus.SetValue(i)
38 m.Update()
39
40 m.AddressRegister.Unset()
41 m.Update()
42
43 m.Enable()
44 m.Update()
45
46 m.Disable()
47 m.Update()
48
49 checkBus(bus, expected)
50 expected--
51 }
52}
53
54func TestMemory64KDoesNotUpdateWhenSetFlagIsOff(t *testing.T) {
55 bus := components.NewBus(arch.BUS_WIDTH)

Callers

nothing calls this directly

Calls 11

SetValueMethod · 0.95
UpdateMethod · 0.95
SetMethod · 0.95
UnsetMethod · 0.95
EnableMethod · 0.95
DisableMethod · 0.95
NewBusFunction · 0.92
NewMemory64KFunction · 0.85
checkBusFunction · 0.70
SetMethod · 0.65
UnsetMethod · 0.65

Tested by

no test coverage detected