+ Reply to Thread
Page 1 of 8 123 ... LastLast
Results 1 to 10 of 75

Thread: Central Processor Unit

  1. #1
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Red face

    Please report bugs and issues you found in this topic, along with typos you found in the ref-docs.
    Basic CPU description:
    • Name: Zyelios CPU 1.50
    • 41 commands
    • 32-bit floating point/integer registers
    • 16 ports (8 input; 8 output)
    • 64KB on board RAM
    • Single-write code
    • Standard memory interface (64-ram compatibility)
    • Latched reset input, partially latched clock input
    • Frequency input
    • Default frequency of 1000 operations per second (1000Hz)
    • Maximum stable frequency of 250000 operations per second (0.25MHz)
    • Direct error output
    Documentation for CPU can be found [ame="http://www.wiremod.com/showthread.php?t=152"]here[/ame]
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  2. #2
    Wirererer Orange's Avatar
    Join Date
    Mar 2007
    Posts
    103

    Default

    this...is... AWSOME!
    Small signatures, are good signatures.

  3. #3
    Administrator Tad2020's Avatar
    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    1,498

    Default

    Your Think() looks strange to me.

    Code:
    function ENT:Think()
    ****self.BaseClass.Think(self)
    ****
    ****local timeout = self.ThinkTime
    ****while (timeout > 0) && (self.Clk >= 1.0) do
    ********self:Execute( )
    ********timeout = timeout - 1
    ****end
    ****self.Entity:NextThink(CurTime()+0.01)
    end
    If you remove self.Entity:NextThink(CurTime()+0.01), the think will run every frame.
    "Our death ray doesn't seem to be working. I'm standing right in it, and I'm not dead yet." - Jamie Hyneman
    "Yes, managing the anonymous activity of the entire Internet is a challenge. Shoving the entire universe into a mason jar for use as a personal flashlight would also be a pesky bother." - Karl, BBR

    WIREMOD WILL NOT WORK ON YOUR FACE! BUT IT DOES ON YOUR MOM :shifty:

  4. #4
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    No. It's supposed to be so.
    Why?
    Timing...

    That was I can be sure that CPU runs on X Hz, and does not overrun that.
    Why would I need that?
    Limiting server load & wire system response time.
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  5. #5
    Administrator Tad2020's Avatar
    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    1,498

    Default

    No. It's supposed to be so.
    Why?
    Timing...

    That was I can be sure that CPU runs on X Hz, and does not overrun that.
    Why would I need that?
    Limiting server load & wire system response time.[/b]
    Ah. Just wondering.
    "Our death ray doesn't seem to be working. I'm standing right in it, and I'm not dead yet." - Jamie Hyneman
    "Yes, managing the anonymous activity of the entire Internet is a challenge. Shoving the entire universe into a mason jar for use as a personal flashlight would also be a pesky bother." - Karl, BBR

    WIREMOD WILL NOT WORK ON YOUR FACE! BUT IT DOES ON YOUR MOM :shifty:

  6. #6
    Wire Amateur TomatoSoup's Avatar
    Join Date
    Mar 2007
    Posts
    72

    Default

    Eh, can I have a list of commands and the syntax? I have no clue whats going on here.

  7. #7
    Wire Amateur Razara's Avatar
    Join Date
    Feb 2007
    Location
    Michigan, USA
    Posts
    64

    Default

    is there any way you could post a save of an example chip. I dont really understand the programming language, but i think if i can see how the chip is suppose to work i can learn to do simple operations with the cpu chip.

  8. #8
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    You did not read the reference. Everything you ask for is in reference docs.
    Here is some simple code with comments:
    Code:
    //Ports:
     //IN:
     //PORT0 - Button pressed, reversed
     //PORT1 - Elevator speed
     //PORT2 - Stop button pressed
     //OUT:
     //PORT0 - Motor
     //PORT5 - Current floor number
     //PORT6 - Moving LED, and elevator door status
     //PORT7 - Floor door open status
    
    //////// Data segment
    DATA;****************//Allocate data segment (Everything after it
    ******************** // and before CODE; is allocated in data segment)
    **alloc floor;****** //Create variable named "floor" and set it to 0
    **alloc z;********** //Create variable named "z" and set it to 0
    **alloc destz;****** //Create variable named "destz" and set it to 0
    //////// Code segment & initialization routine
    CODE;****************//Initialize code segment (Everything below is code)
    **mov #z,0;**********//Store 0 into variable named Z (# means we write to memory)
    **mov port0,#z;******//Store variable Z into port0 (# means we read from memory)
    **mov port5,1;****** //Store 1 into port 5 (we are on floor 1)
    **mov port7,1;****** //Store 1 into port 7 (doors are open)
    **mov #floor,1;******//Store 1 into floor counter
    //////// Read for button presses
    **btnloop:********** //Create label named "btnloop"
    ****mov eax,port0;** //Store port0 into EAX general-purpose register
    ****cmp eax,0;****** //Compare EAX with 0
    ****je btnloop;******//If EAX is greater than 0 then jump to label "btnloop"
    //////// Choose movement direction
    **mov port6,1;****** //EAX > 0 means some buttons was pressed. Store 1 into moving led port
    **mov port7,0;****** //Store 0 into port 7 (close doors)
    **mul eax,256;****** //Multiply pressed button number by 256
    **sub eax,256;****** //Subtract 256 from pressed button number
    **mov #destz,eax;****//Target elevator height - (ButtonNumber - 1) * 256
    **cmp #destz,#z;**** //Compare value in "destz" with value in "z"
    **je dontmove;****** //If its equal, then dont move. Jump over movement
    **jl movedown;****** //If its not equal, and less then jump to move down code
    //////// Move up
    **moveup:************//If its greater than jump to move up code
    ****add #z,port1;****//Add elevator speed to Z value
    ****mov port0,#z;****//Set elevator height to the new Z value
    ****call calcfloor;**//Calculate & show floor number
    ****cmp #destz,#z;** //Compare, are we done moving yet
    ****jg moveup;****** //We are moving up, and destanation > current Z. Continue moving
    ****jmp dontmove;****//We are on the floor. Jump over move down code
    //////// Move down
    **movedown:**********//Move down code
    ****sub #z,port1;****//Subtract speed from Z value
    ****mov port0,#z;****//Set the new elevator height
    ****call calcfloor;**//Calculate & show floor number
    ****cmp #destz,#z;** //Compare destanation Z with our Z
    ****jl movedown;**** //If its under us then continue moving
    //////// Finished moving
    **dontmove:**********//We finished moving/already at floor
    **mov #z,#destz;**** //Store destz into z to prevent mistakes with floor height
    **mov port7,1;****** //Open doors on floor (previously calculated with calcfloor 
    **mov port6,0;****** //Turn off moving LED and open elevator doors
    **jmp btnloop;****** //Jump and wait for keypress again
    
    //////// public CalcFloor()
    calcfloor:********** //FloorNumber = CalcFloor()
    **mov eax,#z;********//Store current height into EAX
    **add eax,256;****** //Floor number = math.Round((z+256) / 256)
    **div eax,256;****** //Divide...
    **rnd eax;********** //Round up value in EAX, and store it back into EAX
    **mov #floor,eax;****//Store floor number
    **mov port5,eax;**** //Display the floor number
    **ret****************//Return from function
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  9. #9
    Administrator Tad2020's Avatar
    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    1,498

    Default

    That helps. You can see just how useful this can be.
    "Our death ray doesn't seem to be working. I'm standing right in it, and I'm not dead yet." - Jamie Hyneman
    "Yes, managing the anonymous activity of the entire Internet is a challenge. Shoving the entire universe into a mason jar for use as a personal flashlight would also be a pesky bother." - Karl, BBR

    WIREMOD WILL NOT WORK ON YOUR FACE! BUT IT DOES ON YOUR MOM :shifty:

  10. #10
    Wire Noob MoPaZ's Avatar
    Join Date
    Mar 2007
    Posts
    6

    Default

    Code:
    CODE;
    loop:
    mov PORT0,PORT1;
    je loop;
    This is my code, but it wont work
    I have wired a thruster to PORT0, and an constant value (1) to PORT1.
    Something more to do?

+ Reply to Thread
Page 1 of 8 123 ... LastLast

Similar Threads

  1. i81 - processor made in pure wires. Building schemes inside!
    By Black Phoenix in forum Finished contraptions
    Replies: 41
    Last Post: 04-27-2011, 08:19 PM
  2. Graphical Processing Unit
    By Black Phoenix in forum Developer's Showcase
    Replies: 174
    Last Post: 05-05-2009, 09:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots