cpu/lib.rs
1//! This crate decodes instructions and emulates the arithmetic unit,
2//! the exchange unit, memory and the CPU side of the I/O system.
3//!
4//! All the work is done in non-blocking function calls into this library.
5//!
6//! The modules within this crate do not directly map to the elements
7//! of the TX-2 machine.
8//!
9//!
10//! | TX-2 Element | Feature | Implementation |
11//! |--- ------------ | ------ | ------------- |
12//! | Control Element | Start/Stop control, CODABO, STARTOVER, Sequencing the stages of instructions | [control]|
13//! | Control Element | Alarms | [alarmunit]|
14//! | In/Out Element | All | [io]|
15//! | Program Element | Sequence flags, Index register storage, Instruction decoding, Instruction, executrion, Deferred addressing| [control]|
16//! | Program Element | Sequence selection and switching | [control]|
17//! | Program Element | Registers N, P, Q, K | [control]|
18//! | Program Element | Configuration memory | [control]|
19//! | Program Element | Jumps | [control]|
20//! | Arithmetic Element | Register A, B, C, D, Arithmetic operations, | [control] |
21//! | Arithmetic Element | Registers Y and Z | Not yet implemented |
22//! | Exchange Element | Load/store process | [exchanger] |
23//! | Exchange Element | Register E | [exchanger] |
24//! | Exchange Element | Register M | [memory] |
25//! | Exchange Element | Quarter activity, subword form, sign extension | [exchanger] |
26//! | In/Out Element | Connecting/disconnecting peripherals, raising the flag of sequences for which I/O is ready | [io]|
27//! | Memory Element | Memory storage | [exchanger](crate::memory) |
28//! | Console | Toggle Start Point Register | [control::ControlUnit] |
29//!
30#![crate_name = "cpu"]
31#![deny(unreachable_pub)]
32#![deny(unsafe_code)]
33#![deny(unused_crate_dependencies)]
34#![warn(clippy::must_use_candidate)]
35#![warn(clippy::manual_string_new)]
36#![warn(clippy::semicolon_if_nothing_returned)]
37//#![warn(clippy::pedantic)]
38#![allow(clippy::unreadable_literal)] // fix later, there are many
39#![warn(clippy::similar_names)] // included in `pedantic`
40#![warn(clippy::if_not_else)] // included in `pedantic`
41#![warn(clippy::items_after_statements)] // included in `pedantic`
42#![warn(clippy::explicit_iter_loop)] // included in `pedantic`
43#![warn(clippy::doc_markdown)] // included in `pedantic`
44#![allow(rustdoc::private_intra_doc_links)]
45
46mod alarm;
47mod alarmunit;
48mod bugreport;
49mod changelog;
50mod context;
51mod control;
52mod diagnostics;
53mod event;
54mod exchanger;
55mod io;
56mod memory;
57mod tx2;
58mod types;
59
60pub use alarm::{Alarm, AlarmDetails, AlarmKind, UnmaskedAlarm};
61pub use alarmunit::AlarmStatus;
62pub use bugreport::bug_report_url;
63pub use context::Context;
64pub use control::{ControlRegisters, ControlUnit, PanicOnUnmaskedAlarm, ResetMode, RunMode};
65pub use event::*;
66pub use io::{
67 DeviceManager, ExtendedConnectedUnitStatus, ExtendedUnitState, InputFlagRaised,
68 set_up_peripherals,
69};
70pub use memory::{MemoryConfiguration, MemoryUnit};
71pub use tx2::Tx2;
72pub use types::*;
73
74pub const PETR: base::prelude::Unsigned6Bit = base::prelude::u6!(0o52);