Dydaktyka
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Ćwiczenia 5, grupa śr. 10-12, 29 marca 2023 ###### tags: `SYK23` `ćwiczenia` `pwit` ## Deklaracje Gotowość rozwiązania zadania należy wyrazić poprzez postawienie X w odpowiedniej kolumnie! Jeśli pożądasz zreferować dane zadanie (co najwyżej jedno!) w trakcie dyskusji oznacz je znakiem ==X== na żółtym tle. **UWAGA: Tabelkę wolno edytować tylko wtedy, gdy jest na zielonym tle!** :::danger | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | ----------------------:| ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | Mateusz Biłyk | | | | | | | | | | | | Mikołaj Dworszczak | | | | | | | | | | | | Kacper Jóźwiak | X | X | X | X | X | | | X | | | | Dominik Kiełbowicz | X | X | X | X | X | X | X | X | | | | Michał Kolasa | | | | | | | | | | | | Konrad Kowalczyk | X | X | X | X | X | | | X | | | | Oskar Kropielnicki | X | X | X | X | X | X | X | X | | | | Anna Krysta | X | X | X | X | X | X | X | X | X | X | X | Jakub Krzyżowski | X | X | X | X | | | | | | | | Oskar Kubkowski | ==X== | X | X | X | X | X | X | X | X | X | | Patryk Maciąg | | | | | | | | | | | | Mateusz Mazur | X | X | X | X | X | ==X== | X | X | X | X | X | Barbara Moczulska | X | X | X | X | X | X | X | X | | | | Kacper Sojda | X | X | ==X== | X | X | X | X | X | X | X | | Marta Strzelec | X | ==X== | X | X |X | X | X | X | | X | | Mikołaj Swoboda | X | X | X | X | X | | | X | | X | | Filip Szczepański | X | X | X | X | X | X | | X | | X | | Julian Włodarek | X | X | X | X | X | X | | X | | X | | Beata Łakoma | x | x | x | x | x | x | x | x | | x | | Michał Łukasik | X | X | X | X | X | X | X | X | X | X | X | ::: :::info **Uwaga:** Po rozwiązaniu zadania należy zmienić kolor nagłówka na zielony. ::: ## Zadanie 1 :::success Autor: Oskar Kubkowski ::: ![](https://i.imgur.com/cy63rLw.png) ![](https://i.imgur.com/1dxiXto.png) 1. Z licznika rozkazów pobieramy numer aktualnego rozkazu, który chcemy wykonać 2. W Instruction Memory wyszukujemy instrukcję z pamięci i rozbieramy ją na części 3. Control Unit wybiera odpowiednią wartość dla ALUControl i RegWrite (wybiera dla wszystkich odpowiednie) 4. W Register File wyszukujemy wartość rejestru y, która dostaniemy na wyjściu w $RD1$ 5. W Sign Extend rozsmarowujemy bit znaku stałej imm, tak żeby miała tyle samo bitów co wartość w rejestrze y 6. w ALU wykonujemy dodawanie wartości y i imm 7. W Data Memory pobieramy wartość zapisaną w rejestrze y+imm 8. W Register File zapisujemy wartość y+imm(WD3) do rejestru x(A3) 9. By przejść do następnej instrukcji zwiększamy licznik rozkazu o 4 (PCPlus4) ## Zadanie 2 :::success Autor: Marta Strzelec ::: ![](https://i.imgur.com/YejgC17.png) ![](https://i.imgur.com/UlPIz9h.png) Zmiana z poprzednim zadaniem: WriteData, która odczytuje nam wartośc rejestru X. MemWrite ustawione na 1, 1. Dostajemy numer instrukcji zapisany w liczniku rozkazów. Następnie w Instruction Memory dostajemy odpowiednią instrukcję. 2. Do Register File wchodzi X na wejściu A1, Y na wejściu A2. 3. Rozszerzamy stałą imm, aby mogła zostać dodana do 32-bitowego rejestru 4. Jednostka arytmetyczno-logiczna wykonuje odpowiednią operację, która została przekazana przez linię sterującą (ALUControl). W tym przypadku jest to dodawanie. Otrzymaliśmy adres, który podajemy do Data Memory 5. Dostajemy odpowiedni sygnal z Control Unit (MemWrite ustawione na 1). W Data Memory zapisujemy pod adresem (x+imm) wartość Y. 6. Aby przejść do następnej instrukcji, zwiększamy licznik rozkazów. ## Zadanie 3 :::success Autor: Kacper Sojda ::: ![](https://i.imgur.com/o4zuoP0.png) ![](https://i.imgur.com/K8Lfc3Y.png) ## Zadanie 4 :::success Autor: Kacper Jóźwiak ::: ![](https://i.imgur.com/zfHdYBW.png) Po przetworzeniu wartości L, dodajemy ją do bieżącej wartości licznika rozkazu PC, a wartości x, y dodajemy do przetworzenia przez ALU. Następnie rozpatrujemy przypadki: * relacja $x$ relop $y$ jest prawdą -> wysyłamy do MUX, znajdującego się przed zegarem, sygnał, aby przejść do wskazanego adresu PC + L, * jest fałszem -> używamy adresu PC + 4. ## Zadanie 5 :::success Autor: Konrad Kowalczyk ::: ![](https://i.imgur.com/J48H8eY.png) a) x = y binop imm nie ma potrzeby rozszerzania procesora o nowe elementy, wystarczy jedynie odpowiednio dostosować ścieżkę ![](https://i.imgur.com/ZYOScQx.png) b) goto L potrzebne będą dodatkowo: - magistrala wykonująca przesunięcie bitowe o 2 miejsca (mnożąca przez 4) - multiplekser do wyrzucania odpowiedniej wartości, jeśli nastąpił lub nie nastąpił skok bezwarunkowy - dodatkowa linia z układu kontrolnego wysyłająca odpowiedni sygnał do wspomnianego multipleksera ![](https://i.imgur.com/9vRMfAJ.png) ## Zadanie 6 :::success Autor: Dominik Kiełbowicz ::: a) PC + MEM + REG + ALU + MEM + MUL + REG = 50 + 250 + 150 + 200 + 250 + 25 + 150 = 1075 b) PC + MEM + REG + ALU + MEM = 50 + 250 + 150 + 200 + 250 = 900 c) PC + MEM + REG + MUL + ALU + MUL + REG = 50 + 250 + 150 + 25 + 200 + 25 + 150 = 850 d) PC + MEM + REG + MUL + ALU + MUL = 50 + 250 + 150 + 25 + 200 + 25 = 700 e) PC + MEM + REG + ALU + MUL + REG = 50 + 250 + 150 + 200 + 25 + 150 = 825 f) PC + MEM + CTRL + MUL = 50 + 250 + 50 + 25 = 375 Cykl musi trwać co najmniej tyle ile najdłuższa ścieżka, a więc 1075ps. ## Zadanie 7 :::success Autor: Oskar Kropielnicki ::: ![](https://i.imgur.com/7CfCqzM.png) $$(25\% \times t_{\text{x=*(y+imm)}} + 11\% \times t_{\text{*(x+imm)=y}} + 12\% \times t_{\text{if x relop goto L}} + 52\% \times t_{\text{x=y binop z}}) = \\ (25\% \times 1075 + 11\% \times 900 + 12\% \times 700 + 52\% \times 850) = \\ = 268.75 + 99 + 84 + 442 = 893.75 \text{ps}$$ $$1 - \frac{893.75\text{ps}}{1075\text{ps}} \approx 1 - 83.13\% = 16.87\%$$ ## Zadanie 8 :::success Autor: Barbara Moczulska ::: ![](https://i.imgur.com/Rtg6egT.png) ![](https://i.imgur.com/ikAvmXA.png) Podobne do zadania 1. - PC - adres -> pamięć instrukcji -> pobranie instrukcji - przekazanie rejestru y do odczytu A1 w Register File - przekazanie rejestru z do odczytu A2 w Register File - W ALU wartości y i z są zsumowane - wynik trafia do Data Memory jest w trybie odczytu z parametrem WE = 0 (MemWrite) - dane z adresu A trafiają do Register File (WE3 = 1 = RegWrite) pod rejestr A3 czyli x gdzie zostanie zapisane - obliczenie adresu następnej instrukcji czyli dodanie 4 bajtów ## Zadanie 9 :::success Autor: Mateusz Mazur ::: ![](https://i.imgur.com/XbMvYrW.png) Możemy zapisać tylko 1 rejestr jednocześnie, a chcemy 2. Zatem na wejściu musimy znać 2 adresy rejestrów x, y oraz ich wartości "x","y" do zamiany. Następnie korzystamy z 2 dodatkowych rejestrów x2, który na wejściu dostaje wartość zwracaną przez y, oraz y2 z wartością z x. Na koniec zwracamy wartości rejestrów x2 ("y") oraz y2 ("x"). ## Zadanie 10 :::success Autor: Filip Szczepański ::: ![](https://i.imgur.com/TW85535.png) ![](https://i.imgur.com/V1LiO2Z.png) ## Zadanie 11 :::success Autor: Michał Łukasik ::: ![](https://i.imgur.com/O8mjmSi.png) Obliczmy czas: x=\*y 50 + 250 + 150 + 250 + 25 + 150 = 875ps PC + mem + reg + mem + mux + reg \*x=y 50 + 250 + 150 + 250 = 700ps PC + mem + reg + mem wtedy długość cyklu to najdłuższa operacja - 875ps ale x=\*(y+imm) oraz \*(x+imm)=y trwają 875ps + 875ps = 1750ps tak jak w zadaniu 7, zakładając długość cyklu równą długości instrukcji, dla tego programu wystarczy obliczyć średnią x=*(y+imm) => 850ps + 875ps = 1725ps *(x+imm)=y => 850ps + 700ps = 1550ps 25% * 1725ps + 11% * 1550ps + 12% * 725ps + 52% * 850ps = 1130,75ps wtedy można obliczyć spowolnienie 1130,75ps / 1075ps ≈ 105% program spowolni o około 5%

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully