As far as I'm aware both instructions have opcode and function code of 0, so how does the computer know which one it's doing?
How are the bytecodes for MIPS nop and sll differentiated?
87 Views Asked by George Bland At
1
There are 1 best solutions below
Related Questions in ASSEMBLY
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- How to call a C language function from x86 assembly code?
- Binary Bomb Phase 2 - Decoding Assembly
- AVR Assembly Clock Cycle
- Understanding the differences between mov and lea instructions in x86 assembly
- ARM Assembly code is not executing in Vitis IDE
- Which version of ARM does the M1 chip run on?
- Why would %rbp not be equal to the value of %rsp, which is 0x28?
- Move immediate 8-bit value into RSI, RDI, RSP or RBP
- Unable to run get .exe file from assembly NASM
- DOSbox automatically freezes and crashes without any prompt warnings
- Load function written in amd64 assembly into memory and call it
- link.exe unresolved external symbol _mainCRTStartup
- x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected
- running an imf file using dosbox in parallel to a game
Related Questions in MIPS
- My prompt message not working in mips program
- How do I extract ints from an array using MIPS Assembly?
- MIPS Aiken to Binary
- Can anyone help me understand why my MIPS assembly code isn't adding or subtracting correctly?
- MIPS runtime error "line 31: Runtime exception at 0x00400038: address out of range 0x7fbffffc Go: execution terminated with errors."
- Getting the error "Error in : invalid program counter value: 0x00000000 Go: execution terminated with errors. " in MIPS assembly
- MIPS $a_ and $v_ registers producing incorrect output
- MIPS pipeline forwarding
- -- program is finished running (dropped off bottom) --
- Implementing beq instruction to a simple control unit in logisim
- MIPS Assembly Language invalid program counter value error
- Code wont stop running in MIPS assembly simulation
- How to read controle signals from the opcode for a single-clock processor
- "Illegal instruction" appear when try to get PRID by mfc0 instruction on Loongson-3A R4 (MIPS64)?
- Seeking Verification: MIPS Cache Set Update Analysis
Related Questions in CPU-ARCHITECTURE
- What is causing the store latency in this program?
- what's the difference between "nn layout" and "nt layout"
- Will a processor with such a defect work?
- How do i find number of Cycles of a processor?
- Why does LLVM-MCA measure an execution stall?
- Can out-of-order execution of CPU affect the order of new operator in C++?
- running SPEC in gem5 using the SimPoint methodology
- Why don't x86-64 (or other architectures) implement division by 10?
- warn: MOVNTDQ: Ignoring non-temporal hint, modeling as cacheable!, While simulating x86 with spec2006 benchamrks I am getting stuck in warn message
- arithmetic intensity of zgemv versus dgemv/sgemv?
- What is the microcode scoreboard?
- Why don't x86/ARM CPU just stop speculation for indirect branches when hardware prediction is not available?
- Question about the behaviour of registers
- How to increase throughput of random memory reads/writes on multi-GB buffers?
- RISVC Single Cycle Processor Data Path and Testbench
Related Questions in INSTRUCTION-SET
- Set value of register to 64-bit integer in RISC-V
- ARMv7A instruction
- Find common minimum CPU features to expect when targeting a certain macOS deployment target
- Why can't we do arithmetic on an operand in x86 asm?
- Arm cortex m0 LDR instruction
- Why is the "mov" with complex addressing faster than the corresponding "lea"?
- Jump (jmp) in microcode with fetch, decode, execute and writeback
- How to decide minimum pmp region for an architecture?
- Does RISCV SBI refers a hardware implementation or a software standard?
- In 6502 assembler, trying to output integers after log statement
- How to compile for riscv zicond extension in gcc?
- Why there is different register address for sstatus an mstatus although they are different view of same register?
- How data dependency handled at cpu instructions pipeline parallelism
- How does RESW in SIC machine works
- VM detection mechanisms for ARM
Related Questions in NO-OP
- Why do the compiler puts nops seemingly without any reason?
- Overwriting segfaulting instructions with NOPs doesn't fix segfault in gdb
- Adding NOP instructions after branches and jumps for control hazards in a 5-stage RISC pipeline without hazard detection?
- nop commerce validation issue
- Adding Function.prototype as a noop callback
- How are the bytecodes for MIPS nop and sll differentiated?
- Python is printing 0x90c2 instead of just 0x90 NOP
- Created a useEffect tear down but still getting a no-op error
- Trying to implement a cleanup in a useEffect to prevent no-op memory leak error
- GCC for Aarch64: what generated NOPs are used for?
- Why does MSVC generate nop instructions for atomic loads on x64?
- Placing NOPs in order to ensure no RAW Data hazard in MIPS assembly
- Cannot print NOP ('\x90') in terminal
- Performance comparison if / else vs state change vs noop in HTMLCanvasElement render loop
- What does it mean "nopw" in the assembly code?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As Jester says, a MIPS CPU doesn't have to differentiate if it doesn't want to do any special performance optimization.
sll $0, $0, 0already has no architectural effect, since writes to$0are discarded, and it has no side effects (MIPS has no FLAGS/condition-codes register). So simple hardware can just let it run through the pipeline.The point of having an agreed-upon
nopopcode is that if hardware wants to look for a special case and not even execute it, there's only the one bit-pattern it has to match on, instead of considering every choice of instruction that writes to$0(except loads which might still fault.)So developers of compilers / assemblers don't have to guess what
nopmight be cheapest for some hardware. Things hardware might do include:nopandsll $t0, $t1, 12in the same clock cycle, even if it couldn't normally run two shifts in the same cycle.$0, it can be skipped for anop. (Only plausible for a toy CPU without bypass forwarding, see below.)Even
sll $t0, $t0, 0has no architectural effect because it writes the register with the same value it already had. But it's a worse choice since hazard detection would normally be looking at register reads and writes, so it might lead to a stall, or a longer dependency chain for$t0on an out-of-order exec MIPS like R10000. If MIPS didn't have a zero register, though, it would be a reasonable choice to agree upon as a NOP, except on MIPS 1 where it wouldn't be safe to put it in the delay slot of a load that wrote$t0.Are there any possible corner cases with
lw $0, (mem)/nopfor hardware that didn't try to special-casenopor the zero-register at all, with the zero register discarding writes and reading as zero handled only in the register file?In that case, it would see an instruction reading a load result in the next instruction. On MIPS I, that gives unpredictable results for the value read since it doesn't stall for that hazard which bypass-forwarding can't handle. (On later MIPS, it stalls; load delay slots aren't architectural, just performance.) Of course the result is eventually just written to the zero register so there's no observable difference.
But if simplistic hardware didn't special case the zero register for bypass forwarding, something like
addiu $0, $0, 123/addi $1, $0, 0could copy a non-zero value. So a correct MIPS design couldn't be that simplistic, and does have to already special case$zerowhen doing hazard detection for bypass forwarding, to make sure it doesn't bypass-forward to a read from$0, which is required to always read zero.A MIPS design that stalls instead of bypass forwarding wouldn't have to special-case
$0in hazard detection, because all values would go through the register file. But that probably wasn't a consideration for MIPS architects because bypass forwarding is essential for good performance in most code.