Skip to content

Commit

Permalink
Merge pull request #346 from cayb0rg/usability-enhancements
Browse files Browse the repository at this point in the history
Usability enhancements
  • Loading branch information
brooksmckinley authored Feb 17, 2024
2 parents ef7175b + de29d97 commit eecfdb7
Show file tree
Hide file tree
Showing 52 changed files with 2,578 additions and 573 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_call:

env:
PROJECT_TRUNK_VERSION: 'v0.16.0'
PROJECT_TRUNK_VERSION: 'v0.18.8'

jobs:
check:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Build
run: trunk build
if: success() || failure()

- name: Check documentation
run: cargo doc --no-deps
if: success() || failure()
Expand Down
37 changes: 32 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ js-sys = "0.3.61"
monaco = { git = "https://github.com/SWIM-ucf/rust-monaco", rev = "c9586e4af77131a15daf53e91e1ad5161a5265e8", features = ["yew-components"] }
wasm-bindgen = "0.2.83"
wasm-bindgen-futures = "0.4.33"
web-sys = {version = "0.3.60", features = ["CssStyleDeclaration", "Event", "HtmlCollection", "HtmlElement", "HtmlInputElement", "HtmlObjectElement", "SvgElement"]}
web-sys = {version = "0.3.60", features = ["CssStyleDeclaration", "Event", "HtmlCollection", "HtmlElement", "HtmlInputElement", "HtmlObjectElement", "SvgElement", "CanvasRenderingContext2d", "Document", "HtmlCanvasElement", "EventTarget", "InputEvent", "ScrollLogicalPosition", "ScrollIntoViewOptions"]}
yew = {version = "0.20.0", features = ["csr"] }
yew-hooks = "0.2.0"
yew-agent = "0.3.0"
Expand All @@ -31,4 +31,10 @@ futures = "0.3.29"
levenshtein = "1.0.5"

# Tests
akin = "0.4"
akin = "0.4"

# Logging
cfg-if = "0.1"
log = "0.4"
console_log = { version = "1", features = ["color"] }
humantime = "2.1.0"
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

<!-- Font for icons used by monaco (codicons) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/codicon.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="static/styles/reset.css"/>
<link rel="stylesheet" href="static/styles/main.css"/>
<link rel="stylesheet" href="static/styles/tabs.css"/>
<link rel="stylesheet" href="static/styles/visual_datapath.css">


<link data-trunk rel="tailwind-css" href="static/styles/tailwind.css" />

<title>SWIM</title>
</head>
<body></body>
Expand Down
3 changes: 3 additions & 0 deletions src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ pub async fn emulation_core_agent(scope: ReactorScope<Command, DatapathUpdate>)
DatapathUpdate::MIPS(MipsStateUpdate::UpdateRegisters(datapath.registers));
let memory_update =
DatapathUpdate::MIPS(MipsStateUpdate::UpdateMemory(datapath.memory.clone()));
let stage_update =
DatapathUpdate::MIPS(MipsStateUpdate::UpdateStage(datapath.current_stage));
state.scope.send(state_update).await.unwrap();
state.scope.send(register_update).await.unwrap();
state.scope.send(memory_update).await.unwrap();
state.scope.send(stage_update).await.unwrap();
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/agent/datapath_communicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl DatapathCommunicator {

/// Copies the contents of `data` to the emulator core's memory at `ptr`. Copies until either the end of `data` or
/// the end of the emulaot core's memory.
pub fn set_memory(&self, ptr: usize, data: Vec<u8>) {
pub fn set_memory(&self, ptr: u64, data: u32) {
self.send_message(Command::SetMemory(ptr, data));
}

Expand Down Expand Up @@ -137,4 +137,8 @@ impl DatapathCommunicator {
pub fn reset(&self) {
self.send_message(Command::Reset);
}

pub fn get_accepting_input(&self) -> bool {
todo!()
}
}
15 changes: 13 additions & 2 deletions src/agent/datapath_reducer.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
use crate::agent::messages::MipsStateUpdate;
use crate::emulation_core::architectures::AvailableDatapaths::MIPS;
use crate::emulation_core::architectures::{AvailableDatapaths, DatapathUpdate};
use crate::emulation_core::mips::datapath::DatapathState;
use crate::emulation_core::mips::datapath::{DatapathState, Stage};
use crate::emulation_core::mips::memory::Memory;
use crate::emulation_core::mips::registers::GpRegisters;
use std::rc::Rc;
use yew::Reducible;

#[derive(PartialEq)]
pub struct DatapathReducer {
pub current_architecture: AvailableDatapaths,
pub mips: MipsCoreState,
}

#[derive(Default)]
#[derive(Default, PartialEq)]
pub struct MipsCoreState {
pub state: DatapathState,
pub registers: GpRegisters,
pub memory: Memory,
pub current_stage: Stage,
}

impl Default for DatapathReducer {
Expand All @@ -40,16 +42,25 @@ impl Reducible for DatapathReducer {
state,
registers: self.mips.registers,
memory: self.mips.memory.clone(),
current_stage: self.mips.current_stage,
},
MipsStateUpdate::UpdateRegisters(registers) => MipsCoreState {
state: self.mips.state.clone(),
registers,
memory: self.mips.memory.clone(),
current_stage: self.mips.current_stage,
},
MipsStateUpdate::UpdateMemory(memory) => MipsCoreState {
state: self.mips.state.clone(),
registers: self.mips.registers,
memory,
current_stage: self.mips.current_stage,
},
MipsStateUpdate::UpdateStage(stage) => MipsCoreState {
state: self.mips.state.clone(),
registers: self.mips.registers,
memory: self.mips.memory.clone(),
current_stage: stage,
},
},
},
Expand Down
5 changes: 3 additions & 2 deletions src/agent/messages.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::emulation_core::architectures::AvailableDatapaths;
use crate::emulation_core::mips::datapath::DatapathState;
use crate::emulation_core::mips::memory::Memory;
use crate::emulation_core::mips::registers::GpRegisters;
use crate::emulation_core::{architectures::AvailableDatapaths, mips::datapath::Stage};
use serde::{Deserialize, Serialize};

/// Commands sent from the UI thread to the worker thread.
Expand All @@ -11,7 +11,7 @@ pub enum Command {
Initialize(usize, Vec<u32>),
SetExecuteSpeed(u32),
SetRegister(String, u64),
SetMemory(usize, Vec<u8>),
SetMemory(u64, u32),
Execute,
ExecuteInstruction,
ExecuteStage,
Expand All @@ -25,4 +25,5 @@ pub enum MipsStateUpdate {
UpdateState(DatapathState),
UpdateRegisters(GpRegisters),
UpdateMemory(Memory),
UpdateStage(Stage),
}
Loading

0 comments on commit eecfdb7

Please sign in to comment.