Transfer data from memory to register / register to memory?

AI Thread Summary
The discussion revolves around transferring data between registers and memory in a hypothetical microprocessor design. Key questions include how to write data from a temporary register (R1) to register memory and how to read data from R1 into the accumulator (A). It is clarified that the instruction set should define the source and destination registers, typically using a command like "mov A, R1." The user seeks guidance on specifying operands and creating binary sequences for instructions, emphasizing the need for clarity in distinguishing between source and destination registers. The conversation highlights the importance of a well-defined instruction set for effective data manipulation in the microprocessor.
vead
Messages
92
Reaction score
0
hello
I need some help. I created one example to understand some basic
component
ram memory
A accumulator 4bit
R1 resistor 4 bit ( R1 is temporary data storage register )
  • Register memory address bus - 2 bits (RA0,1);
  • Register memory data bus - 4 bits (RD0~3);
  • Register memory read enable;
  • Register memory write enable.
Load the data directly with register R1
mov R1 # data

stored the content R1 register into register memory
Q1 how to write data (stored in R1) to register memory ?

load the data from memory register and store into A accumulator
Q2 how to read the content of R1 and stored into A register ?
 
Technology news on Phys.org
vead said:
hello
I need some help. I created one example to understand some basic
component
ram memory
A accumulator 4bit
R1 resistor 4 bit ( R1 is temporary data storage register )
  • Register memory address bus - 2 bits (RA0,1);
  • Register memory data bus - 4 bits (RD0~3);
  • Register memory read enable;
  • Register memory write enable.
Load the data directly with register R1
mov R1 # data

stored the content R1 register into register memory
Q1 how to write data (stored in R1) to register memory ?
A register already is memory, so there's no difference between writing directly to, say, register R1 and writing to register memory.
vead said:
load the data from memory register and store into A accumulator
Q2 how to read the content of R1 and stored into A register ?
Since you are designing the instruction set for this hypothetical microprocessor, you should already have an instruction to do this. Something like mov A, R1. That will read the value in R1 and write it to the accumulator (A).
 
  • Like
Likes vead
Mark44 said:
A register already is memory, so there's no difference between writing directly to, say, register R1 and writing to register memory.

Since you are designing the instruction set for this hypothetical microprocessor, you should already have an instruction to do this. Something like mov A, R1. That will read the value in R1 and write it to the accumulator (A).

instruction set for this hypothetical microprocessor

suppose we have 8 bit instruction

first 4 bit for opcode and last 4 bit for register specification I have following component component
ram memory
A accumulator 4bit
R1 resistor 4 bit ( R1 is temporary data storage register )

4 bit opcode +2 bit source register +2 bit destination register + 2 bit data

MOV A #data
mov R1 # data
how does A register or R1 know that Its a source register or destination register ?
 
vead said:
instruction set for this hypothetical microprocessor

suppose we have 8 bit instruction

first 4 bit for opcode and last 4 bit for register specificationI have following component component
ram memory
A accumulator 4bit
R1 resistor 4 bit ( R1 is temporary data storage register )

4 bit opcode +2 bit source register +2 bit destination register + 2 bit data

MOV A #data
mov R1 # data
how does A register or R1 know that Its a source register or destination register ?
A register doesn't "know" anything. It's the mov instruction that determines which register is read from (the source) and which register is written to (the destination).
 
Mark44 said:
A register doesn't "know" anything. It's the mov instruction that determines which register is read from (the source) and which register is written to (the destination).

look at my another effort

Instruction set
  • opcode - instruction name
  • operand - data or address
6 bit opcode +mode +5 bit source register + 6 bit for destination register
Mode
0 address (without #)
1 number (with #)

Code:
Opcode         instruction       mode                           example
000000          nop                  0 address                           ------
000001          Load                1 number                       Ld A # 12
000010          Load                0 address                       Ld 12
000100          Add                  0 address                       Add 12
001000          Add                  1 number                        Add A # 12
010000          Sub                  0 address                       Sub 12
100000          Sub                  1 number                        Sub A # 12
111111          Store               0 address                         ST 12

I wrote few instruction just for example .I have 256 instruction

Assembly code
loads the number 12 into the accumulator
Code:
Ld A # 12

Bianry code

000001 1 00000 001100

Assembly code
Code:
Add # 12
Add the number 12 into the accumulator

binary code

001000 1 00000 001100
stores the result into memory location 12
Code:
ST 12
Memory
address number
11 10
12 24
13 05
saves the accumulator result (24) to the memory address 12
Bianry code

001000 0 00000 001100

Assembly code

Ld A # 12
Add A # 12
ST 12
Code:
binary code

000001 1 00000 001100
001000 1 00000 001100
001000 0 00000 001100

Ld A #5
Ld R1#3
Add A,R1
look this example here I am using source and destination register

my main problem that I don't understand how to specify the operand ?

If I have accumulator , memory register R1,R2 R3.....etc
Q1 how to know that which register use as source register or destination register . ?
because both accumulator and memory register can be used as source or destination

Q2how to make binary sequence for instruction set ( opcode source and destination register ) ?

I already made some sequence but I am getting problem when I try to make binary sequence for following example
Add A,R1
 
vead said:
look at my another effort

Instruction set
  • opcode - instruction name
  • operand - data or address
6 bit opcode +mode +5 bit source register + 6 bit for destination register
Mode
0 address (without #)
1 number (with #)

Code:
Opcode         instruction       mode                           example
000000          nop                  0 address                           ------
000001          Load                1 number                       Ld A # 12
000010          Load                0 address                       Ld 12
000100          Add                  0 address                       Add 12
001000          Add                  1 number                        Add A # 12
010000          Sub                  0 address                       Sub 12
100000          Sub                  1 number                        Sub A # 12
111111          Store               0 address                         ST 12

I wrote few instruction just for example .I have 256 instruction

Assembly code
loads the number 12 into the accumulator
Code:
Ld A # 12

Bianry code

000001 1 00000 001100

Assembly code
Code:
Add # 12
Add the number 12 into the accumulator

binary code

001000 1 00000 001100
stores the result into memory location 12
Code:
ST 12
Memory
address number
11 10
12 24
13 05
saves the accumulator result (24) to the memory address 12
Bianry code

001000 0 00000 001100

Assembly code

Ld A # 12
Add A # 12
ST 12
Code:
binary code

000001 1 00000 001100
001000 1 00000 001100
001000 0 00000 001100

Ld A #5
Ld R1#3
Add A,R1
look this example here I am using source and destination register

my main problem that I don't understand how to specify the operand ?
Do it the same way as you did the examples just before this (i.e., Ld A #12, Add A, #12, ST 12).
You're already specifying the operand in your binary code. For example, taking one of your examples above, you have
000001 1 00000 001100
Taking these in groups from left to right, we have:
000001 - Load
1 - number
00000 - accumulator
001100 - immediate value 12

vead said:
If I have accumulator , memory register R1,R2 R3.....etc
Q1 how to know that which register use as source register or destination register . ?
because both accumulator and memory register can be used as source or destination

Q2how to make binary sequence for instruction set ( opcode source and destination register ) ?

I already made some sequence but I am getting problem when I try to make binary sequence for following example
Add A,R1
I don't understand why this is so difficult for you. You have already specified how the bits in the binary code mean.
6 bit opcode +mode +5 bit source register + 6 bit for destination register
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
3
Views
2K
Replies
18
Views
6K
Replies
6
Views
2K
Replies
10
Views
3K
Replies
13
Views
7K
Replies
15
Views
4K
Replies
4
Views
2K
Replies
15
Views
3K
Back
Top