Skip to content

Commit

Permalink
feat: Add bus activations for display
Browse files Browse the repository at this point in the history
  • Loading branch information
furesoft committed Oct 27, 2024
1 parent e0988db commit 8d6d3cc
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Canvas Height="320" Width="600">
<TextBlock Text="Display" TextAlignment="Center" VerticalAlignment="Center" Canvas.Top="75" Canvas.Left="500" />

<mimaComponents:BusControl Canvas.Top="0" Canvas.Left="385" Width="15" Height="40" State="None" core:BusRegistry.Id="base_to_display" />
<mimaComponents:BusControl Canvas.Top="40" Canvas.Left="385" Width="15" Height="40" State="None" core:BusRegistry.Id="display_to_dc" />
<mimaComponents:BusControl Canvas.Top="0" Canvas.Left="385" Width="15" Height="55" State="None" core:BusRegistry.Id="base_to_display" />
<mimaComponents:BusControl Canvas.Top="55" Canvas.Left="385" Width="15" Height="20" State="None" core:BusRegistry.Id="dy" />

<mimaComponents:BusControl Canvas.Top="40" Canvas.Left="336" Width="49" Height="15" State="None" core:BusRegistry.Id="display_to_dx" />
<mimaComponents:BusControl Canvas.Top="40" Canvas.Left="335" Width="15" Height="40" State="None" core:BusRegistry.Id="dx" />
Expand Down
2 changes: 1 addition & 1 deletion src/MimaSim/MimaSim/Controls/MimaControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<w:StackWrapper Canvas.Top="55" Canvas.Left="510" />

<w:DisplayWrapper Canvas.Top="210" Canvas.Left="12" />
<w:DisplayWrapper Canvas.Top="218" Canvas.Left="12" />
</Canvas>
</Border>
</UserControl>
13 changes: 13 additions & 0 deletions src/MimaSim/MimaSim/MIMA/Components/CPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ public CPU()
BusRegistry.ActivateBus("controlunit_sp");
});

Display.DX.Bus.Subscribe(_ =>
{
BusRegistry.Activate("cu->dx");
});
Display.DY.Bus.Subscribe(_ =>
{
BusRegistry.Activate("cu->dy");
});
Display.DC.Bus.Subscribe(_ =>
{
BusRegistry.Activate("cu->dc");
});

X.Bus.Subscribe(_ =>
{
BusRegistry.Activate("cu->x");
Expand Down
8 changes: 4 additions & 4 deletions src/MimaSim/MimaSim/MIMA/Components/Clock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public Clock(short frequency)
_frequency = frequency;
_timer = new Timer(_frequency);
_timer.Elapsed += _timer_Elapsed;

Stoped += BusRegistry.DeactivateAll;
}

public event Action<object> FrequencyChanged;
Expand Down Expand Up @@ -41,10 +43,8 @@ public void Stop()

private void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
CPU.Instance.Step();

System.Threading.Thread.Sleep(10);

BusRegistry.DeactivateAll();

CPU.Instance.Step();
}
}
37 changes: 33 additions & 4 deletions src/MimaSim/MimaSim/Resources/BusMap.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<busactivations>
<activator id="cu->x">
<setbus id="alu_input_x2"/>
<mainbus value="42"/>
<mainbus value="35"/>
</activator>
<activator id="cu->y">
<setbus id="alu_input_y2"/>
<mainbus value="55"/>
<mainbus value="46"/>
</activator>
<activator id="cu->accu">
<setbus id="base_to_accu"/>
<mainbus value="42"/>
<mainbus value="35"/>
</activator>
<activator id="cu->mem">
<setbus id="memory_data2"/>
<setbus id="memory_adresss2"/>
<mainbus value="100"/>
<mainbus value="83"/>
</activator>

<activator id="alu->cu">
Expand All @@ -23,4 +23,33 @@

<mainbus value="35"/>
</activator>

<activator id="cu->stack">
<mainbus value="100"/>
</activator>

<activator id="cu->dx">
<mainbus value="75"/>

<setbus id="base_to_display" />
<setbus id="display_to_dx" />
<setbus id="dx" />
</activator>

<activator id="cu->dy">
<mainbus value="75"/>

<setbus id="base_to_display" />
<setbus id="display_to_dy" />
<setbus id="dy" />
</activator>

<activator id="cu->dc">
<mainbus value="75"/>

<setbus id="base_to_display" />
<setbus id="display_to_dc" />
<setbus id="dc" />
</activator>

</busactivations>

0 comments on commit 8d6d3cc

Please sign in to comment.