Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified start and build statements #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions configurator/package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"web-vitals": "^0.2.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files"
Expand Down
96 changes: 65 additions & 31 deletions configurator/src/components/pages/ConfigureCpuComponent.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,59 @@
import {Alert, AlertIcon, Box, Heading, Tab, TabList, TabPanel, TabPanels, Tabs, Text} from "@chakra-ui/react";
import {GeneralSettingsForm} from "../forms/GeneralSettingsForm";
import {GenericSettingsFormComponent} from "../forms/GenericSettingsFormComponent";
import {VerilogSettingsForm} from "./VerilogSettingsForm";
import {EnterProgramForm} from "./EnterProgramForm";
import React from "react";
import {hazardsParams, pipelineParams} from "./HomePage";
import React, { useState } from "react";
import { Alert, AlertIcon, Box, Heading, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from "@chakra-ui/react";
import { GeneralSettingsForm } from "../forms/GeneralSettingsForm";
import { GenericSettingsFormComponent } from "../forms/GenericSettingsFormComponent";
import { VerilogSettingsForm } from "./VerilogSettingsForm";
import { EnterProgramForm } from "./EnterProgramForm";
import { hazardsParams, pipelineParams } from "./HomePage";

export function ConfigureCpuComponent({
configuratorGlobalSettings,
setConfiguratorGlobalSettings,
formErrors,
generalSettings,
onFormattingChange,
onVersionChange,
programText,
setProgramText,
settings,
userChangedStages,
userChangedStages1
}) {
return <Box mt={5} mb={15} mx='auto' maxW='100vh' pb={10} borderBottomWidth={2}>
configuratorGlobalSettings,
setConfiguratorGlobalSettings,
formErrors,
generalSettings,
onFormattingChange,
onVersionChange,
programText,
setProgramText,
settings,
userChangedStages,
userChangedStages1,
}) {
const [receivedAsmCode, setReceivedAsmCode] = useState("");

<Heading size="lg" mb={4}>Configure your CPU now</Heading>
<Tabs borderWidth={1} borderRadius="lg" p={3} isFitted>
<TabList className="tab-list">
const receiveAsmCode = (event) => {
// Check the origin of the event
// Add your origin check here if needed

// Access the asm code array from the compiler
var asmCodeArray = event.data.asmCode;

// Check if asmCodeArray is defined and is an array
if (asmCodeArray && Array.isArray(asmCodeArray)) {
// Convert the array of objects into a string
var asmCodeString = asmCodeArray.map(instruction => instruction.text).join('\n');

// Use the asm code string as needed, e.g., display in the code editor
console.log("ASM code sent from parent window to warp-v");

// Update the state with the received ASM code (if you're using React state)
setReceivedAsmCode(asmCodeString);
} else {
console.warn("Invalid asmCodeArray:", asmCodeArray);
}
};

// Listen for messages
window.addEventListener("message", receiveAsmCode);


return (
<Box mt={5} mb={15} mx="auto" maxW="100vh" pb={10} borderBottomWidth={2}>
<Heading size="lg" mb={4}>
Configure your CPU now
</Heading>
<Tabs borderWidth={1} borderRadius="lg" p={3} isFitted>
<TabList className="tab-list">
<Tab>General</Tab>
<Tab>Multi-Core</Tab>
<Tab>Pipeline</Tab>
Expand Down Expand Up @@ -83,12 +113,16 @@ export function ConfigureCpuComponent({
/>
</TabPanel>
<TabPanel>
<EnterProgramForm configuratorGlobalSettings={configuratorGlobalSettings}
setConfiguratorGlobalSettings={setConfiguratorGlobalSettings}
programText={programText} setProgramText={setProgramText}
/>
</TabPanel>
</TabPanels>
</Tabs>
</Box>;
<EnterProgramForm
configuratorGlobalSettings={configuratorGlobalSettings}
setConfiguratorGlobalSettings={setConfiguratorGlobalSettings}
programText={programText}
setProgramText={setProgramText}
receivedAsmCode={receivedAsmCode}
/>
</TabPanel>
</TabPanels>
</Tabs>
</Box>
);
}
58 changes: 32 additions & 26 deletions configurator/src/components/pages/EnterProgramForm.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import React from "react";
import {Box, Checkbox, Text, Textarea, Stack} from "@chakra-ui/react";
import React, { useEffect } from "react";
import { Box, Checkbox, Text, Textarea, Stack } from "@chakra-ui/react";

export function EnterProgramForm({
configuratorGlobalSettings,
setConfiguratorGlobalSettings,
programText,
setProgramText
}) {
return <>
<Box>
<Stack direction="column">
configuratorGlobalSettings,
setConfiguratorGlobalSettings,
programText,
setProgramText,
receivedAsmCode,
}) {
useEffect(() => {
// Use receivedAsmCode as needed, e.g., set it to the programText state
setProgramText(receivedAsmCode);
}, [receivedAsmCode, setProgramText]);

return (
<>
<Box>
<Stack direction="column">
<Checkbox value={configuratorGlobalSettings.generalSettings.customProgramEnabled}
isDisabled={configuratorGlobalSettings.generalSettings.isa === "MIPSI"}
onChange={e => setConfiguratorGlobalSettings({
Expand All @@ -28,21 +35,20 @@ export function EnterProgramForm({
customInstructionsEnabled: e.target.checked
}
})}>Include template for custom instructions</Checkbox>
</Stack>

</Stack>

<Text mb={2}>
Here, you can provide your own assembly program that will be hardcoded into the instruction memory
of
your core.
The syntax roughly mimics that defined by the RISC-V ISA, but not exactly.
</Text>
<Textarea rows={programText.split("\n").length}
isDisabled={!configuratorGlobalSettings.generalSettings.customProgramEnabled}
value={programText}
onChange={e => setProgramText(e.target.value)}
fontFamily="'Courier New', monospace"
/>
</Box>
</>
<Text mb={2}>
Here, you can provide your own assembly program that will be hardcoded into the instruction memory of your
core. The syntax roughly mimics that defined by the RISC-V ISA, but not exactly.
</Text>
<Textarea
rows={programText.split("\n").length}
isDisabled={!configuratorGlobalSettings.generalSettings.customProgramEnabled}
value={programText}
onChange={(e) => setProgramText(e.target.value)}
fontFamily="'Courier New', monospace"
/>
</Box>
</>
);
}