Questions tagged [cpu-architecture]
The hardware microarchitecture (x86, x86_64, ARM, ...) of a CPU or microcontroller.
3,609
questions
0
votes
1
answer
25
views
How many True dependencies does this code have?
LW t1, 0(t4) ; t1 ← address (0+t4)
ADDI t1, t1, #8 ; t1 ← t1+8
MULT t3, t1, t1 ; t3 ← t1*t1
SW t3, 4(t2) ; address(4+t2) ← t3
I'm currently unable to tell how many true dependencies this code has. ...
2
votes
0
answers
42
views
Use "arithmetic shift right" as "less than zero"
Is the following:
psrad xmm0, 31 ; arithmetic (sign-extend) shift right
equivalent to:
xorps xmm1, xmm1 ; zero
cmpps xmm0, xmm1, 1 ; less than
I am interested to know, because the ...
0
votes
1
answer
28
views
Why A and B registers are used in multicycle Datapath?
Why are registers A and B whose inputs are ReadData1 and ReadData2 of RegisterFile are necessary? Isn't it possible to use directly the values which are on ReadData1 and ReadData2 outputs of Register ...
-1
votes
0
answers
22
views
Create a branch history in loop
Consider
int t = 0;
for( int i = 0; i < 8; i++ )
{
for( int j = 0; j < 8; j++ )
{
t = t + i*j;
}
}
Ex: Create a branch history table in t = t + i*j if we assume branch taken in ...
0
votes
0
answers
29
views
Optimize a loop for static predict-not-taken? Which prediction problems exist for that in a normal loop?
Which problems arise in the following assembly loop, if Predict Not Taken is chosen by default? Optimize the example to Predict not Taken.
addi $s1, $zero, 1024 // s1 := 1024
loop: addi $s1, $s1, -1 //...
1
vote
1
answer
56
views
Can compilers break control dependencies used for LoadStore memory ordering or similar, in any real use-cases?
I'm reading the mail list about LKMM: Add volatile_if(). The control dependency is somewhat subtle since it is easily forgotten by us developers. So I wonder is there any real case that is caused by ...
-1
votes
0
answers
18
views
Operating system interrupt handler and CPU in virtual memory access
Which of these activities are performed by the CPU while execution the instructions and which by the Operating System (OS) interrupt handler that manages page faults? I am not sure about the ...
4
votes
1
answer
114
views
Why didn't x86 implement direct core-to-core messaging assembly/cpu instructions?
After serious development, CPUs gained many cores, gained distributed blocks of cores on multiple chiplets, numa systems, etc but still a piece of data has to pass through not only L1 cache (if on ...
1
vote
1
answer
43
views
Does L1 cache accept new incoming requests while its Line Fill Buffers (LFBs) are fully exhausted?
I wonder if L1 cache still receives new requests that hit L1D, making forward progress for the pipeline when Line Fill Buffers (LFBs or MSHRs) get full?
Or could anybody help me write a microbenchmark ...
2
votes
0
answers
91
views
+50
C++ atomics and memory_order with RDMA
When using one-sided RDMA on modern memory, lock-free, the question arises of how a remote reader can safely view their incoming data if the data objects span multiple cache lines.
In the Derecho open-...
0
votes
0
answers
19
views
Write allocation policy with caches [duplicate]
I was just wondering about in write allocation policy of caches, first we access data from main memory and put into cache and then update in the cache. If anyway we use write back policy to counter ...
0
votes
0
answers
28
views
What is an address/range of addresses that are guaranteed to be not used in x86-64?
I am writing a version of malloc that is compatible with multi-threading. Is is going to use arenas to help facilitate the parallelism.
mmap is being used to create the arenas. Using NULL as the input ...
0
votes
0
answers
89
views
Direct Mapping Cache Exercise
Consider a computer with the following characteristics: total of 1Gbyte of main
memory; word size of 1 byte; block size of 32 bytes; and cache size of 128 Kbytes.
a)For the main memory addresses of ...
0
votes
0
answers
17
views
[risc-v]does 2-way Simultaneous multithreading core share register files, or do they have separate registers? [duplicate]
For example, in an 4-core system with 2-way SMT, you have 8 harts, which is it? 4 separate x0-x31 registers ,pc, and csrs, or 8 separate x0-x31, pc, and csrs?
0
votes
0
answers
11
views
How does hardware (cpu or similar) provide any protection for the OS's essential memory [duplicate]
So basically this might be a dumb question but how does hardware (cpu or related) protect virtual data even though all the cpu or any other hardware is doing is sending electricity around, it wouldn't ...
-4
votes
0
answers
36
views
Write simultaneously two mesochronous inputs into a single port sram
I am trying to figure out a method how to write simultaneously two inputs into a single port SRAM module.
The two inputs have the same clock frequency but different phase.
The worst scenario is that ...
0
votes
1
answer
34
views
cpuid: reported micro-architecture seems ambiguous
Ubuntu 20.04 LTS. Note (unknown type) reported:
$ cpuid | less
CPU 0:
vendor_id = "GenuineIntel"
version information (1/eax):
processor type = primary processor (0)
family ...
1
vote
0
answers
44
views
Custom Instruction crashing with SIGNAL 4 (Illegal Instruction): RISC-V (32) GNU-Toolchain with QEMU
I have been wanting to develop and understand the process of creating custom extensions for a large-scale task I have, involving RISC-V compilation using the QEMU emulator. I have been loosely ...
5
votes
1
answer
160
views
Performance differ significantly when inner loop iterates less times?
I wrote a toy program that compares the performance of two very similar functions. The entire file (minus a couple of macros) looks like this:
constexpr int iterations = 100000;
using u64 = uint64_t;
...
0
votes
1
answer
35
views
Assuming that you had a MIPS processer with PIPELINE but without hazard prevention nor forwarding, would this be the correct placement of NOP?
I would like to check my work and understanding of pipelines, unfortunately MARS doesn't accommodate this feature so it is hard to verify my hypothesis.
I placed the instructions in a spreadsheet to ...
0
votes
0
answers
79
views
Why does riscv32-gcc use LI and ADDI to put a 32-bit constant in a register, not LI with the full constant?
....
//---------------------------------
// Init State
//---------------------------------
int32_t state[16];
state[0] = 0x61707865;
...
|| c -> asm(riscv32-gcc -S inputcode.c)
|| ...
-1
votes
0
answers
84
views
Bad CPU type in executable mac Intel core
Trying to install a specific version of nvm
But I get
nvm install 16.14.2
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/...
0
votes
1
answer
54
views
Why is the IEEE754 double precision format only accurate to 15 digits?
I am currently learning about floating point representations. According to this website, here are the possible ranges for this representation. -1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308. ...
2
votes
1
answer
39
views
How to determine machine architecture in Python? [duplicate]
I'm wondering how to find the architecture of the machine python is running on and save it to a string.
The only other example I've been able to find works only on Windows, and doesn't even detect the ...
-2
votes
1
answer
21
views
I want to find the expexted hazards until CC7(clock cycle 7) with appropriate reasons and solution
I want to find the expexted hazards in below code until clock cycle 7 with appropriate reasons and solution.
1: sub $2,$2,$3
2: lw $4, 0($2)
3: and $1,$4,$2
4: beq $1,$2,1
5: or $5,$1,$6
6: add $2,$5,$...
0
votes
0
answers
16
views
Direct mapped cache - Small cache block size and high offset
I have to deal with different cache block sizes ranging from 4 to 128 for 16-bit words, depending on the cache controller mode. The adresses are 20-bit long with 8 bits for tag, 8 bits for cache ...
0
votes
2
answers
77
views
Why does this piece of code written using uint8_t run faster than analogous code written with uint32_t or uint64_t on a 64bit machine?
Isn't the common knowledge that math operations on 64bit systems run faster on 32/64 bit datatypes than the smaller datatypes like short due to implicit promotion? Yet while testing my bitset ...
-1
votes
1
answer
46
views
How can output from parent and child of fork() system call interleave with each other?
code reads something like :
pid=fork()
if(pid){
print parent_id
print parent_id
}
else{
print child_id
print child_id
}
when it was executed it was
child
parent
child
parent
I ...
0
votes
1
answer
44
views
Page table look-up vs TLB look-up
From https://cs.stackexchange.com/questions/119744/how-does-a-tlb-lookup-compare-all-keys-simultaneously and https://en.wikipedia.org/wiki/Content-addressable_memory, look-up a key in TLB could be ...
0
votes
0
answers
49
views
How to calculate expected CPI and cpu time when instruction types are given?
I got two questions about cpu time and CPI but it is hard than I expected because of unfamiliar words :(
Could you tell me whether my answer is right or not.
Question :
If company A has designed a ...
0
votes
0
answers
26
views
How does x86 ALU instructions access memory for fetching operands? [duplicate]
Recently I am learning assembly but having hard time understanding it.
There was question whether x86 ALU instructions directly access memory for fetching operands,
but I have no idea if it is ...
-1
votes
0
answers
28
views
How to obtain number of FPU units in a single CPU core?
I want in a program way estimate peak performance of CPU.
For that purpose I want to query some microarchitectural details in a program way - like how many functional units(or execution units) of what ...
0
votes
0
answers
17
views
shared memory memcpy performance issue
I'm doing some performance tunning on a shared memory based message queue. I found a strange phenomenon that I can't explain: I ran the same code for 3 epochs, the avg running time is getting better ...
1
vote
0
answers
21
views
How do I assign an address to a label? WinMIPS64
Everything runs well until I reach lw r9, 0(r7) because I dont have the address of the labels. How do I make it so I can store the address of the labels and jump to the label?
Im supposed to make it ...
0
votes
1
answer
66
views
Adding a new instruction to QEMU
I'm a little confused going about adding a new instruction to QEMU and want to confirm if my understanding is right. After going through the source code, I think adding an instruction to QEMU involves ...
0
votes
1
answer
34
views
Does sequential consistency implies cache coherence?
The definition of cache coherence says that:
A read must return the most recent write.
Every write must eventually be accessible via a read.
Writes to a given location are seen in the same order by ...
2
votes
1
answer
51
views
8086 lock pin and ASM LOCK prefix how it works
I am a programmer and learning assembly language in order to intuitively understand how my code run on the CPU.
While I was studying the ASM keyword LOCK, google told me CPU will take exclusive ...
1
vote
0
answers
31
views
Why the stack pointer is special in the register file?
I have a question about the register file.
As I know, the stack pointer is one of the special registers in the register file. Why it is determined specifically?
I mean compiler can define any register ...
0
votes
1
answer
61
views
What does the TargetWrite/IorD Control Line do on a multicycle MIPS processer
We learned all the main details about control lines and the general functionality of the MIPS chip in single cycle and also with pipelining.
But, in multicycle the control lines aren't identical in ...
1
vote
1
answer
71
views
Why is the Overflow-Flag only set when single shifts are used?
In the x86 intel reference manual it says:
"The overflow flag is set only if the single-shift forms of the instruction are used. [...]"
But when I have the following scenario:
xor eax, eax
...
1
vote
0
answers
34
views
Load/store hazard handling in Tomasulo's algorithm
I'm a little confused about the execution of memory instructions in Tomasulo's algorithm. I read that a load instruction is not put into load buffers if its effective address is the same as a previous ...
0
votes
1
answer
103
views
Can CPU Out-of-Order-Execution cause memory reordering?
I know store buffer and invalidate queues are reasons that cause memory reordering. What I don't know is if Out-of-Order-Execution can cause memory reordering.
In my opinion, Out-of-Order-Execution ...
1
vote
0
answers
49
views
Shortcomings of cache coherence alternative
I am trying to understand why cache coherence protocols are designed the way they are. The goal of the cache coherence is to serialize reads/writes to a particular memory location across all cores.
...
3
votes
2
answers
162
views
What happens to outstanding stores after an object is deleted?
Consider the following simple function (assume most compiler optimizations turned off) being executed by two threads on different cores on an X86 CPU with a store buffer:
struct ABC
{
int x;
//...
-1
votes
1
answer
36
views
Cpu photolithography by order
I made a couple of processor architectures based on risk-v, And I would like to know if there are companies that make cpu by order,I don’t want to make homemade processors based on PSB boards because ...
0
votes
0
answers
48
views
knowing info about cpu while developing kernel
Is there any data structures of bios or any thing in CMOS to tell about cpu vendor and it's version. I can know about how many processor in system by bios mulitiprocessor specification struct in bios ...
0
votes
1
answer
27
views
Installation path for .Net based components building using Any CPU
.Net Assemblies built with AnyCPU will JIT to 64-bit code when loaded into a 64-bit or 32-bit process based on the CPU. I am creating a WiX installer.
What should be the default path (Program File x86/...
-1
votes
1
answer
40
views
Hexadecimal Convention in address [duplicate]
How the 4kb is 0FFF in Hexadecimal
Can anyone explain how it is 0FFF so how to solve this type of questions in general
-1
votes
1
answer
59
views
I can't handle this error in my Verilog code: "error: malformed statement" [duplicate]
"main.v:38: error: malformed statement". In Adder module Call.
I want to implement ALU in Verilog but I got this error.
Even StackOverflow's previous question couldn't help me.
module Adder(...
1
vote
0
answers
71
views
Performance differences in SIMD operations across different CPU architectures
I see an important performance difference between a SIMD-based sum reduction versus its scalar counterpart across different CPU architectures.
The problematic function is simple; you receive a 16-byte-...