mips32

MIPS32 router: module_init not called for kernel module

喜欢而已 提交于 2019-12-04 04:17:01
问题 I'm developing a kernel module that I want to run on my router. The router model is DGN2200v2 by Netgear. It's running Linux 2.6.30 on MIPS. My problem is that when I load my module it seems that my module_init isn't getting called. I tried to narrow it down by modifying my module_init to return -3 (which indicates an error?) and insmod still reports success. I can see my module in the output of lsmod , but I don't see my printk output using dmesg . For starters, I wanted to create the

Need help in adding more functionality to MIPS Single Cycle Datapath

老子叫甜甜 提交于 2019-12-03 22:01:53
I am trying to add jal functionality to the following but I am stuck with how does it work. I know that it stores the old PC+4 value in the $ra register and then transfers the control to the function which transfers back the control by return $ra but how do I implement it in the hardware? There are two things you need to do. Add a mux at the input of the Registers so that the PC+4 value can be selected as the data to be written. With the appropriate control signal this will allow you to write PC+4 as an additional effect of the "jal $ra" instruction. Implement the return "jr $ra" instruction.

MIPS assembly for a simple for loop

删除回忆录丶 提交于 2019-12-03 08:22:12
I need to translate this C code to MIPS assembly. Here is the C code: int tmp = 0; for (int j = 0; j < 15; ++j) tmp = tmp * 2 + 3 This is my MIPS assembly code. Is it a correct translation? If you see any mistakes I would really like to know. # tmp = $v0 # j = $t0 .globl main main: li $v0,0 loop: bgt $t0,15,exit addi $t0,$t0,1 mul $t1,$v0,2 add $v0,$t1, 3 j loop exit: Your loop goes from 0 to 14, so your bgt instruction should be: bgt $t0,14,exit I think. . You don't set j ($t0) to zero before the loop. Raul Batalha .data mensage: asciiz "Text Test" newline: asciiz "\n" .text # tmp = $v0 # j =

MIPS Programming: Load Address

元气小坏坏 提交于 2019-12-01 13:54:19
The Background I am a student just beginning to learn MIPS for one of my courses, and my professor is not allowing the usage of pseudo-instructions such as Load Address ( la ) in our code. I am wondering what an example of the correct usage of standard instructions would look like to store the address of a declared variable into a register for use later in the code. My Solution I have currently been attempting to use this code, though I am getting a syntax error in the lui instruction. main: .data Array: .space 80 #Declares that Array will hold 20 integers .text lui $s0, Array #loads most

MIPS Programming: Load Address

南笙酒味 提交于 2019-12-01 11:12:08
问题 The Background I am a student just beginning to learn MIPS for one of my courses, and my professor is not allowing the usage of pseudo-instructions such as Load Address ( la ) in our code. I am wondering what an example of the correct usage of standard instructions would look like to store the address of a declared variable into a register for use later in the code. My Solution I have currently been attempting to use this code, though I am getting a syntax error in the lui instruction. main:

Bubble Sorting using MIPS

喜欢而已 提交于 2019-12-01 07:28:12
问题 I have made the inner loop which is doing comparison and swapping but i am having a difficulty in implementing outer loop which will run according to the number of elements. .data Arr: .word 5, 4, 3, 2, 1 .text .globl main main: la $a0, Arr # Pass the base address of the array Arr to input argument register $a0 addi $a1, $zero, 5 # initialze the value of sorting loop ($al=5) li $t1, 0 # initialize the value of outer loop (t1=0) sort: lw $s1, 0($a0) # Load first element in s1 lw $s2, 4($a0) #

How to create a jump table using a jr instruction?

眉间皱痕 提交于 2019-12-01 02:01:26
C++ Program # include < iostream > # include <string > using namespace std; int main () { int resistance ; // in Ohms string partNum ; // Part Number cout << " Enter resistance : " << endl ; cin >> resistance ; switch ( resistance ) { case 3 : partNum = " OD30GJE "; break ; case 10 : partNum = " OD100JE "; break ; case 22 : partNum = " OD220JE "; break ; default : partNum = "No match "; break ; } cout << " Part number : " << partNum << endl ; return 0; } Translate the C code to MIPS assembly code, add to your code the capability to match the closest resistor. Be sure to use the jr instruction

Big Endian and Little Endian

为君一笑 提交于 2019-11-30 05:14:09
问题 Given is the snap shot of memory of a byte-addressable computer. What would be loaded into register $16 after execution of instruction lw $16, 24($17) if machine is big endian and when Little Endian. Register $17 contains 200 . Now according to me, four bytes would be copied from the memory (224-227) irrespective of Little Endian or Big Endian,then if the machine is Big Endian then they will be copied to the register as they are. If the machine is Little Endian then will be reversed and then

How to load memory address without using pseudo-instructions?

时间秒杀一切 提交于 2019-11-29 11:04:28
I'm trying to learn MIPS assembly language by myself using MARS simulator . For didactic reasons I'm limiting myself to not using pseudo-instructions. While trying to get the address of some data into a register, I ran into a problem because I cannot use la . I tried using lui in combination with ori , the same as if I was to load a number directly, to no avail: .data arr: .byte 0xa1 .byte 0xb2 .byte 0xc3 .byte 0xd4 .byte 0xe5 .byte 0xf6 .byte 0x7a .byte 0x8b .byte 0x9c .byte 0xad .text lui $s0, mem # <--- mars just gives me errors here :( ori $s0, mem # ?? ... Is this doable using

How to load memory address without using pseudo-instructions?

断了今生、忘了曾经 提交于 2019-11-28 04:21:28
问题 I'm trying to learn MIPS assembly language by myself using MARS simulator . For didactic reasons I'm limiting myself to not using pseudo-instructions. While trying to get the address of some data into a register, I ran into a problem because I cannot use la . I tried using lui in combination with ori , the same as if I was to load a number directly, to no avail: .data arr: .byte 0xa1 .byte 0xb2 .byte 0xc3 .byte 0xd4 .byte 0xe5 .byte 0xf6 .byte 0x7a .byte 0x8b .byte 0x9c .byte 0xad .text lui