HW6 Task 0 - Setup

  1. Make sure you are running the latest versions of SMOK and Cebollita. (See the Files section of the main assignment page.)
    $ cebsim --version
    UI version: 2.4 (Build 41)
    Debugger version: 2.4 (Build 41)
    DebuggableMachine version: 2.4 (Build 41)
    CebMachine version: 2.4 (Build 41)
    OSHandler version: 2.4 (Build 41)
    

    Warning: You actually need V7.1.9 of SMOK to complete this project. See this page for why (and for why I'm not updating this image.)

  2. In cygwin, navigate to the directory in which you want to create the directory of project files. Issue the cvs command given in the Files section of the main assignment page. A new directory, smokCacheProject, is created.

  3. In a Windows explorer window, navigate to the smokCacheProject folder. Double-click on file smokCacheProject.sln. Visual Studio starts. Select the Build menu, then Build Solution. Stuff happens. When it's over you should see (in a pane near the bottom, with high likelihood):
    ---------------------- Done ----------------------
    
        Build: 1 succeeded, 0 failed, 0 skipped
    

    You've just compiled and linked the code for the degenerate cache implementations. A folder named executables should have been created in your smokCacheProject folder, and inside it you should find file smokCachePackage.smokdll. That's the executable version of your code. (It cannot be run on its own, however, only from SMOK.)

  4. Run SMOK. Select the Edit menu, then Edit Smok Env Vars. Append the path to your executables directory (e.g., O:\cse378\hw6\smokCacheProject\executables). Use a semi-colon to separate this new path element from what was there already.
    This setting will be remembered, so you won't have to do it again for a particular kind of machine (i.e., lab or home).

  5. Shut down SMOK and restart it. Select the View menu, then Package Information, then smokCachePackage.
    Shut down SMOK.

    Note: If you attempt to build your code while running a SMOK process, you will get an error like this:

    Linking...
    LINK : fatal error LNK1168: cannot open Executables/smokCachePackage.smokdll for writing
    
    Build log was saved at "file://c:\cse378\smokCacheProject\Debug\BuildLog.htm"
    smokCacheComponent - 1 error(s), 0 warning(s)
    
    
    ---------------------- Done ----------------------
    
        Build: 0 succeeded, 1 failed, 0 skipped
    
    This is because Visual Studio is unable to overwrite the output executable file while it is in use.

  6. Restart Visual Studio on your project if you shut it down (see Step 3). In the Solution Explorer pane, expand smokCacheComponent, then expand Source Files. Double-click on ICache.cpp to bring it up in the editor pane.

    Here's what this looks like for me. What it looks like for you will probably be a bit different, as Visual Studio is squirrelly about what is placed where (or even shown -- if you don't see a pane at all try diciphering the View menu to see if you can get it to come up).

  7. Change the PACKAGE_AUTHOR and PACKAGE_DATE in ICache.cpp. Re-build. Verify that the changes have taken place (Step 5).

    Don't shut down Visual Studio yet.

  8. Create a cache component in SMOK:
    A (purple) ICache component is created.

  9. Go back to Visual Studio. Click to the left of the lines shown, to create breakpoints (the red circles).

  10. Debug "your code" in the running copy of SMOK by selecting the Debug menu, then Processes... Find the SMOK process in the list and hit Attach. Make sure Native is selected, then hit OK, then Close.

  11. Go back to SMOK and type ctrl-f (step). Visual Studio asserts itself. The yellow arrow shows you that you've reached a breakpoint. The bottom left pane shows the values of variables used in that statement; the bottom right the call stack. I've annotated some of the toolbar buttons near the upper right in red.
    We reached this breakpoint because the ComputeOutput method is called at each clock up.

  12. Hit the Go button to continue. You immediately reach the breakpoint in LatchInputs, the method called each clock down.

  13. Hit Go again. You go back to the ComputeOutput breakpoint. This is because SMOK simulates to the middle of a cycle (after up but before down) before stopping, so that when you look at the outputs on the display they are correct, given that the inputs may have changed due to latching at clock down of the last cycle.

  14. Hit Go again. SMOK is running, waiting for user input.