y86 | A Y86 pipeline CPU simulator in JavaScript

 by   shuding JavaScript Version: Current License: MIT

kandi X-RAY | y86 Summary

kandi X-RAY | y86 Summary

y86 is a JavaScript library typically used in Hardware applications. y86 has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

y86.js.org is a JavaScript powered, Y86 pipeline CPU emulator with a sci-fi UI (Y86 is a classic project in book CS:APP3e).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              y86 has a low active ecosystem.
              It has 503 star(s) with 71 fork(s). There are 25 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 12 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of y86 is current.

            kandi-Quality Quality

              y86 has no bugs reported.

            kandi-Security Security

              y86 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              y86 is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              y86 releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of y86
            Get all kandi verified functions for this library.

            y86 Key Features

            No Key Features are available at this moment for y86.

            y86 Examples and Code Snippets

            No Code Snippets are available at this moment for y86.

            Community Discussions

            QUESTION

            tk.h looks for tcl.h in /usr/include but tcl.h is in /usr/include/tcl. I don't have write tk.h privilege to fix code
            Asked 2021-Feb-22 at 13:26

            I am using Ubuntu 20.04.2 LTS via VMWare on macOS BigSur. I have the latest versions of tcl, tcl-dev, tk and tk-dev installed - version 8.6. I want to compile the source code for the Architecture lab project. The source code is from 2016 and located in the self-study handout. Compilation fails [with error messages detailed below], possibly due to the source code relying of tcl8.5 instead of the latest version. Would installing versions 8.5 of these packages solve the problem?

            To make the GUIs work, in the project Makefile I need to assign one variable [which I have done] and update two more so that gcc can find the relevant libraries [libtcl.so and libtk.so] and header files [tcl.h and tk.h].

            ...

            ANSWER

            Answered 2021-Feb-22 at 13:26

            Direct access to the Tcl_Interp struct has for long been deprecated. Given that this is a single source file (psim.c), you might want to patch it to properly use:

            • Tcl_SetResult(), for example: Change interp->result = "No arguments allowed"; to Tcl_SetResult(interp, "No arguments allowed", TCL_STATIC);
            • Tcl_GetStringResult(), for example: Change fprintf(stderr, "Error Message was '%s'\n", sim_interp->result); to fprintf(stderr, "Error Message was '%s'\n", Tcl_GetStringResult(sim_interp));

            This is backwards compatible.

            Not recommended, but doable: Set the macro

            Source https://stackoverflow.com/questions/66291922

            QUESTION

            Why is writing considered an input operation and reading considered an output operation?
            Asked 2020-Jul-01 at 21:39

            I'm currently working my way through Computer Systems: A Programmer's Perspective 3, and in chapter 4 they consistently refer to read operations in the Y86 processor as being output from various CPU components and I don't understand why. Surely we would want to input data from memory into hardware component?

            Here's a quote from the text alongside an accompanying diagram:

            The Register file has four ports. It supports up to two simultaneous reads (on ports A and B) and two simultaneous writes (on ports E and M). Each port has both an address connection and a data connection, where the address connection is a register ID, and the data connection is a set of 64 wires serving as either an output word (for a read port) or an input word (for a write port) of the register file.

            This correspondence has been consistent through the text

            ...

            ANSWER

            Answered 2020-Jul-01 at 21:39

            It's just a matter of perspective:

            A read port: a port from which you can read: i.e. data will flow from the register file to the reading entity, thus from the perspective of the register file implementation the data connection is an output wire.

            Source https://stackoverflow.com/questions/62685557

            QUESTION

            Why the rA:rB is 2:8 instead of 2:f in the execution of a pushl instruction?
            Asked 2019-Dec-20 at 01:14

            I'm reading the 4th chapter of Computer Systems: A Programmer's Perspective and learn about the sequential Y86 implementations.So here is the Assembly code:

            And we trace the execution of the pushl instruction to analysis each step of the push operation.Here is the process,left part is generic,right part is specific:

            I can understand all of the steps except for the rA:rB.Look at the first picture and the instruction is a02f,so in this condition,icode:ifun should be a:0,rA:rB should be 2:f.However,accodring to the book,rA:rB is actually 2:8 instead of 2:f.But why?And I really don't know where the '8' come from.

            ...

            ANSWER

            Answered 2019-Dec-20 at 01:14

            It’s an errata, and it’s listed in the errata page for the 2nd edition of the book:

            Chapter 4: Processor Architecture

            • p. 370, Aside tracing the pushl instruction: The second instruction byte should be 0x2f, instead of 0x28. The value of rB in the Fetch stage should be 0xf instead of 0x8.

            Source https://stackoverflow.com/questions/59393114

            QUESTION

            RISC-V educational hexacode listing
            Asked 2019-Mar-23 at 01:19

            I want to change my educational-purpose simulator from Y86 to RISC-V. I like the Y86 combined hexacode+listing file, like

            ...

            ANSWER

            Answered 2019-Mar-23 at 00:32

            RARS has a view which shows address, hexcode, elementary instruction and source code side by side.

            You can likely get a similar hexcode/source view in the terminal using GNU standard tools (like objdump) that have RISC-V support.

            Additionally there is https://github.com/michaeljclark/riscv-disassembler which may serve your needs.

            Disclaimer: I am main author and maintainer of RARS.

            Source https://stackoverflow.com/questions/54442948

            QUESTION

            How to find an instruction in a pipe line in while implementing conditional jump
            Asked 2019-Mar-14 at 11:30

            I came across a question while preparing for an exam. The question is

            Consider the following y86 code snippet when answering the following questions about implementation of the conditional jump in the 5 stage pipeline presented in class, with stages F, D, E, M, WB.

            ...

            ANSWER

            Answered 2019-Mar-14 at 02:20

            After which stage will the pipeline know whether the conditional jump should be taken or not? Circle the correct stage

            Some in-order pipelined CPUs handle branch taken/not-taken in the Decode stage, to make it only a 1 cycle bubble in the pipeline. (e.g. MIPS does this, which is why 1 branch-delay slot is enough for a classic 5-stage MIPS pipeline to fully hide the control dependency/hazard. https://en.wikipedia.org/wiki/Classic_RISC_pipeline#Control_hazards).

            A design that stalls or speculates until the branch reached Execute is viable too, but lower performance.

            So this question seems un-answerable, unless you have some other clue about how your y86 classic 5-stage pipeline is designed.

            Resolving branch direction in Decode requires the flags to be ready sooner, so cmp or sub followed by jcc would always cause a stall for the data dependency. Checking flags is even easier than checking a register after decoding which register needs to be checked, and reading it from the register file. (MIPS doesn't have flags; it has instructions like beq $t1, $t2, target to branch on equality (which can be done with less latency than a subtract), or bltz $t1, target to check the sign bit of one reg.

            Source https://stackoverflow.com/questions/55153622

            QUESTION

            C++ Y86 Disassembler - How to interpret .quad
            Asked 2019-Feb-05 at 17:34

            So, for a class assignment we are writing a Y86 (toy processor) disassembler in C++. Easy enough, I have almost everything done, except for disassembling instructions into a .quad directive.

            The quad directive takes a numeric or hexadecimal value, and then converts it into an 8-byte "instruction" (it's not really an instruction, .quad is the only thing in the processor that takes 8 bytes so if you come across an 8 byte line you automatically know you're looking at a quad) that is representative of the value. Here's an example below since my explanation may not be great:

            https://image.prntscr.com/image/h5xAoE4YRryl7HSJ13o5Yg.png

            It's easy enough to see that the first two quads there are bit shifted 2 to the right on disassembly, but then the next two are bit-shifted 2 to the left. What's the pattern I'm missing here? Here's some more examples of disassembled quads:

            ...

            ANSWER

            Answered 2019-Feb-05 at 17:33

            It's easy enough to see that the first two quads there are bit shifted 2 to the right on disassembly, but then the next two are bit-shifted 2 to the left.

            There's no 2 bit shift. There is what appears, if not paying close attention, to be a 2 nibble (8 bit) shift.

            What's the pattern I'm missing here?

            It's not bit shifting, it's reverse byte ordering.

            Instead of repetitive patterns such as 000A000A000A try experimenting with counting patterns such as 0123456789AB

            And pay attention to the most significant word, which is 0x0000 in nearly all of your examples. It appears at the end of the byte sequence, but becomes leading zeros (not even printed) in the decode.

            Source https://stackoverflow.com/questions/54539886

            QUESTION

            Is there a way to perform arithmetic right shift using only xorq, andq, addq, iaddq, & subq?
            Asked 2018-Nov-21 at 08:16

            I'm in a hypothetical architecture that only has those operations (Y86). No arithmetic right shift exists. I'm essentially trying to capture the upmost bit to determine if the number is negative and if so add it to the result register, rax.

            Edit:

            Sorry all, I forgot to specify, I'm trying to avoid conditional branches to see if it improves the efficiency. No cmov exists in the version I'm in.

            The furthest I've gotten is:

            ...

            ANSWER

            Answered 2018-Nov-19 at 20:54

            Assuming you can use a loop and conditional branch:

            Source https://stackoverflow.com/questions/53382256

            QUESTION

            Accessing Elements of an Array inside of an Array - Y86 Assembly
            Asked 2018-Aug-03 at 22:45

            I am wondering that in assembly (in my case Y86), is it possible to have an array inside of an array? And if it is, how would I access the elements inside of that array. I know you dereference arrays to get their elements, but that's only with one array in a stack. Is there a way to get an element inside of an array inside of an array.

            Example because that's challenging to explain:

            Normal grab of an element:

            ...

            ANSWER

            Answered 2018-Aug-03 at 22:45

            The pushl %edx does not store the array to the stack, but the memory address of first element.

            In your other example the first element of array2 is 32 bit integer value, which is equal to memory address of array1, so in C language terms the array2 is array of pointers.

            When you fetch first element of array2 into some register, you have "pointer" (memory address) in it, and by fetching value from that address you will fetch first element of array1 (or you can modify it by some offset to fetch further elements).

            This "array of pointers to arrays" pattern is often used when you have several arrays of same/similar type with different lengths and you want to store them continuously in memory, for example:

            Source https://stackoverflow.com/questions/51664968

            QUESTION

            Multidimensional Array (2x2) Initialization in Assembly Language - Y86
            Asked 2018-Jul-30 at 08:25

            I am new to assembly language and I'm using a simpler version called Y86, essentially the same thing. I wonder how to initialize a multidimensional array in such a format, specifically making a 2x2. Later with the 2x2 I will be adding two matrices (or arrays in this case). Thank you!

            ...

            ANSWER

            Answered 2018-Jul-30 at 08:25

            In machine code you have available (for information storage) CPU registers and memory.

            Registers have fixed names and types and they are used like that, for example in x86 you can do mov eax, 0x12345678 to load 32b value into register eax.

            Memory is like continuous block of byte-cells, each having it's own unique physical address (like: 0, 1, 2, ... mem_size-1). So it is like 1 dimensional byte array.

            Whatever different type you want, in the end it is somehow mapped to this 1D byte array, so you have to first design how that mapping happens.

            Some mappings like for example 32 bit integers have native mappings/support in the instructions, so you can for example read whole 32b int by single instruction like mov eax,[address], not having to compose it from individual bytes, but the CPU will for you read four bytes from memory at addresses: address+0, address+1, address+2 and address+3 and concatenate it into 32 bit value (on x86 CPU in little-endian order, so the byte from address+0 is in the lowest 8 bits of final value).

            Other mappings like "array 2x2" don't have native support, and you have to design the memory layout and write the code accordingly to support it. For 2 dimensional arrays often mapping memory_offset = (row * columns_max + column) * single_element_byte_size is used.

            Like for 16x16 matrix of 32 bit floats you can calculate memory offset (from the start of matrix data, which is at offset 0):

            Source https://stackoverflow.com/questions/51574355

            QUESTION

            Parse a file using ANTLR4
            Asked 2018-Jul-27 at 18:55

            I have a Lexer and a Parser called y86 Lexer and Parser which work as far as I know. But I have a file with y86 commands and I want to parse them using Java. So far I have code as follows.

            ...

            ANSWER

            Answered 2018-Jul-27 at 18:55

            For each rule ruleName in your grammar, the y86Parser class will contain a class named RuleNameContext and a method named ruleName(), which will parse the input according to that rule and return an instance of the RuleNameContext class containing the parse tree. You can then use listeners or visitors to walk that parse tree.

            So if you don't have a compilationUnit method or a CompilationUnitContext class, your grammar probably just doesn't have a rule named compilationUnit. Instead you should pick a rule that you do have and call the method corresponding to that rule.

            Source https://stackoverflow.com/questions/51563845

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install y86

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/shuding/y86.git

          • CLI

            gh repo clone shuding/y86

          • sshUrl

            git@github.com:shuding/y86.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with y86

            Consider Popular JavaScript Libraries

            freeCodeCamp

            by freeCodeCamp

            vue

            by vuejs

            react

            by facebook

            bootstrap

            by twbs

            Try Top Libraries by shuding

            nextra

            by shudingTypeScript

            react-wrap-balancer

            by shudingHTML

            cobe

            by shudingJavaScript

            tilg

            by shudingTypeScript

            nextra-docs-template

            by shudingTypeScript