Let's say I have two integer variables a and b. I want to sum up a and b and write the calculated result to standard output or a file. Is it possible to do it without writing the result to memory in modern CPU architectures?
Asked
Active
Viewed 64 times
1
-
The answer depends very much on what you mean by "standard output" and "file". If you mean a UART or a hardware storage device, such as an SD card, then you can certainly move a data value from a processor register to one of these devices without involving other memory. If your question assumes that there is an operating system involved you might want to fill us in on those details. – Nov 23 '13 at 00:32
-
@JoeHass I just wonder whether it's possible to do such an operation that produces an output that a specific memory architecture cannot hold. (Let's say the sum exceeds the maximum limit of integer data type.) I asked assuming there's an operation system it you can share any article about this issue with an OS or not, it would be great. – osman Nov 23 '13 at 00:54
-
Sorry but now I'm more confused. Do you want to move data from a processor to an I/O device without storing it in memory, or are you asking if a processor can produce data that cannot be stored in memory? In either case, you really need to provide more information about what you have in mind. This is just too cryptic. – Nov 23 '13 at 01:07
-
I want to move data from a CPU register to an I/O but my memory architecture doesn't support the type of output data calculated by ALU so I can't use memory to transfer that data. There's an OS between my program and the computer. AFAIK there's two of saving data: One is simply writing the data in my register to a memory location (Is there a CPU architecture that has a specific instruction for writing data to an I/O directly?) and the other is a system call that calls the OS so it can read the data in my register and move the data to a filesystem with using memory. (Is it possible?) – osman Nov 23 '13 at 01:42
-
If my question is dumb, I'm sorry. I have only work with MIPS Assembly and I'm not really quite familiar with these systems. I'm just curious about how it works so it there's article or key terms that I can search on the Internet, it would be nice. – osman Nov 23 '13 at 01:44
-
1OK, that helps. Your question is not dumb but it just needed to be fleshed out a bit. As far as I know, all CPU architectures allow writing data to a specific memory location and most computer systems use "memory mapped I/O', which means that the I/O devices are controlled by writing to specific memory locations. So, yes, in most cases you can move data directly from a CPU register to an output device or a storage device but it could be misleading to call them "standard output" or a "file". Please explain what type of output data you are talking about. – Nov 23 '13 at 01:53
-
Thanks a lot. I think the key was the memory mapped I/O. :) The type doesn't matter actually, it was just an example. I thought that if I just want to save data to an I/O, writing that data into a memory location would be overhead. However it seems memory mapped I/O fixes this problem. If you could write your comment as an answer, I would gladly accept that answer. – osman Nov 23 '13 at 02:39