Menu

How can I access memory data of device that use d_ram model?

fiveight
2017-08-17
2017-08-17
  • fiveight

    fiveight - 2017-08-17

    Hi All:
    I am using ngspice.dll.
    I want to set memory data of device that used d_ram model befor starting simulation like ROM, and access memory data of this device every time when send data callback function was called. For example, get the value of one byte with a given address, or set the value of one byte.
    How can I make this? Thanks!

     

    Last edit: fiveight 2017-08-17
    • marcel hendrix

      marcel hendrix - 2017-08-17

      Dear fiveight,

      I answered a similar question to this one in the forums once (sorry can't find the link now).

      Why don't you simply load the ROM file in a static variable when your INIT section is called?
      (see XSPICE documentation).

      -marcel

       
      • fiveight

        fiveight - 2017-08-17

        Thanks!
        But I didn't understand. Do you mean writing my own code model?

         
        • marcel hendrix

          marcel hendrix - 2017-08-17

          Ok, I see d_ram already exists and it cannot be bulk initialized in the way you want.
          Maybe you could write a d_rom model which is largely a copy of the existing
          code and add what you want to the init section?

          Or maybe (as you only need ROM), you can use the file_source model with an
          adc_bridge.

          -marcel

           
          • Holger Vogt

            Holger Vogt - 2017-08-17

            Make a circuit to accomplish this:
            A multiplexer on the address and i/o-lines of the RAM.
            Switch the RAM either into your circuit or into a prgramming mode with extra circuitry.
            This extra circuit reads an (anaolg) input vector, translates it into a digital byte (by adc_bridge), reads the address from another vector, programs the RAM, and switches it back into your circuit. Use the alter command to change the contents of the vectors.

            Holger

             
            • fiveight

              fiveight - 2017-08-18

              Thanks!
              I have the same idea before I create this topic. But I am not sure.Now I will try this.
              If it works, does this mean I can implement any chips in this way? Maybe I can program 8051 8086 8253 8259 ......chips, and these chips can simulate with ngspice.

               
              • marcel hendrix

                marcel hendrix - 2017-08-18

                Maybe I can program 8051 8086 8253 8259 ......chips,
                and these chips can simulate with ngspice

                In principle you certainly can, in practice you really shouldn't.

                What do you want to accomplish with such a simulation, i.e.
                what level of detail is needed? It might be more reasonable to
                have a behavioral/XSPICE model of most of such a chip, maybe
                combined with transistor- or gate-level simulation of some
                interesting I/O pins.

                -marcel

                 
                • fiveight

                  fiveight - 2017-08-21

                  Maybe it is too hard.
                  I want to accomplish some features like Proteus. For example, simulate MCU and peripheral equipment chips, and let them work together. Make the designer of schematic can read register values of these chips at any time or every clock when simulating.
                  Maybe I should use code model of XSPICE to accomplish this.

                   

Log in to post a comment.