plantuml
@startuml
title 2bit CPU 状態遷移図(2bit符号付き)
skinparam state {
BackgroundColor #EEF5FF
BorderColor Black
FontSize 12
}
' 状態(2bit表現と意味)
state "00 (0)" as S0
state "01 (1)" as S1
state "10 (-2)" as S2
state "11 (-1)" as S3
' S0 = 00
S0 -[#DD00AA,bold]-> S1 : +1
note on link
00 + 01 = 01
end note
S0 -[#DD00AA,bold]-> S3 : -1
note on link
00 + 11 = 11
end note
S0 -[#DD00AA,bold]-> S2 : +2
note on link
00 + 10 = 10
end note
S0 -[#DD00AA,bold]-> S2 : -2
note on link
00 + 10 = 10
end note
' S1 = 01
S1 -[#red,bold]-> S2 : +1
note on link
01 + 01 = 10
end note
S1 -[#red,bold]-> S0 : -1
note on link
01 + 11 = 00
end note
S1 -[#red,bold]-> S3 : +2
note on link
01 + 10 = 11
end note
S1 -[#red,bold]-> S3 : -2
note on link
01 + 10 = 11
end note
' S2 = 10
S2 -[#1AB100,bold]-> S3 : +1
note on link
10 + 01 = 11
end note
S2 -[#1AB100,bold]-> S0 : -1
note on link
10 + 11 = 00
end note
S2 -[#1AB100,bold]-> S0 : +2
note on link
10 + 10 = 00
end note
S2 -[#1AB100,bold]-> S1 : -2
note on link
10 + 10 = 01
end note
' S3 = 11
S3 -[#blue,bold]-> S0 : +1
note on link
11 + 01 = 00
end note
S3 -[#blue,bold]-> S2 : -1
note on link
11 + 11 = 10
end note
S3 -[#blue,bold]-> S1 : +2
note on link
11 + 10 = 01
end note
S3 -[#blue,bold]-> S2 : -2
note on link
11 + 10 = 10
end note
@enduml