Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A simple I/O port uses the following configuration registers for input and output. int IO_Port[2] = {0}; // &IO_Port[0] = base address to IO_Port IO_Port[0]

A simple I/O port uses the following configuration registers for input and output.

int IO_Port[2] = {0};

// &IO_Port[0] = base address to IO_Port

IO_Port[0] = Enable I/O Register (EIOR) // Register is 32 bits wide

IO_Port[1] = Data Direction Register (DDR) // Register is 32 bits wide

IO_Port[2] = IO Register (IOR) // Register is 32 bits wide

The Enable I/O Register is 32 bits wide.

If Enable I/O Register (EIOR) bit(n) = 1, IO Register(bit n) is enabled.

Else EIOR bit(n) = 0, IO Register(bit n) is disabled.

Data Direction Register (DDR) defines input and output directions (32 bits wide).

If DDR bit(n) = 1, then I/O port bit(n) = output,

Else DDR bit(n) = 0, then I/O port bit = input.

IO Register (IOR) contains the input and output bit states (32 bits wide).

A read from IOR register reads in the input and output bit states.

A write to IOR register, writes the output bits to the outside world and input bit states are not changed by a write.

# to read from I/O port

READ: ADDI $1,$0,&IO_Port[2]

LW $2,0($1) # places the input and output bit states into

# register $2

# to write to I/O port

WRITE: ADDI $1,$0,&IO_Port[2]

ADDI $2,$0,A # $2 = A (C char type)

SW $2,0($1) # places $2 into I/O Register

(11a) Given: Enable_IO_Register = 0x0000 07FE, which I/O bits are enabled?

(11b) Given: IO_Port[1] = 0x0000 0FF0 // Data Direction Register = 0x0000 0FF0,

Which I/O bits are configured as inputs and outputs?

(11c) Given the MIPS code in (4c), and $6 = 0xA5, what are the values of the input bits

START: ADDI $1,$0, IO_Port[0] # EIOR_Address = Memory Address for EIOR

ADDI $2,$0, IO_Port[1] # DDR_Address = Memory Address for DDR

ADDI $3,$0, IO_Port[2] # IOR_Address = Memory Address for I/O Port

ADDI $4,$0,0xFF # Load EIOR integer to Enable bits 7..bit0 for I/O

SW $4,0($1) # Store value in EIOR register to enable I/O bits

ADDI $5,$0,0x3C # Set bits 7 bit 6 as inputs

# Set bits 5 bit 2 as outputs

# Set bits 1 bit 0 as inputs.

SW $5,0($2) # Store 0x3C to DDR register

LW $6,0($3) # IOR_Address is memory address for I/O Register

# $6 = 0xA5= Read I/O register

Given $6 = 0xA5, what are the values of the input bits?

(11d) Given the MIPS code in (4c), and $6 = 0x7F, what are the values of the output bits.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago