Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

What does an address space contain?

Hi, I added a simple component LCD12864 into nios system.Then I got the address space from system.h:#define LCD12864_BASE 0x00000800#define LCD12864_SPAN 16But I don't know:1) Why SPAN=16.2) What contents in the space: LCD12864_BASE=? LCD12864_BASE+1=? LCD12864_BASE+2=? ... LCD12864_BASE+15=?Looking for your help.Thanks in advanceLiuJN

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The answer is in these two pieces of code:

      else if (avs_chipselect & avs_write)  
      begin  
        case (avs_address)  
          0: coe_e      <= avs_writedata;  
          1: coe_rw     <= avs_writedata;  
          2: coe_rs     <= avs_writedata;  
          3: coe_data_o <= avs_writedata;  
        endcase  
      end
    and
      if (avs_chipselect & avs_read)  
      begin  
        if (avs_address == 3)  
          readdata_r  <= coe_data_i;  
        else  
          readdata_r  <= 8'b0;  
      end  
      else 
        readdata_r <= 8'b0;  
    assign avs_readdata = {24'b0, readdata_r};

    Writing on the first 3 addresses changes one signal to the lcd controller, controlled by the LSB of your data word (i.e. write "0" to drive the signal low and "1" to drive it high). Address LCD12864_BASE controls E, LCD12864_BASE+4 controls RW, and LCD12864_BASE +8 controls RS. On the last address (LCD12864_BASE+12), you control the data written to the controller with the low 8 bits.

    Reading on the first 3 addresses returns 0, and reading from LCD12864_BASE+12 returns you the word written by the LCD controller in the low 8 bits.

    The component uses 32-bit data registers for read and write, and has 4 registers. That's why the span is 4*4=16. This is also why you need to increase the address in steps of 4 to access each register.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you very much,Daixiwen.Can you tell me more about it:1)Does the address space contain only conduit_end?2)Is there any paper describe it in detail?Thank you more.LiuJN.

    I am sorry that I dont know why my post can only display in one line.