{"action":"created","issue":{"url":"https://api.github.com/repos/cliffordwolf/picorv32/issues/33","repository_url":"https://api.github.com/repos/cliffordwolf/picorv32","labels_url":"https://api.github.com/repos/cliffordwolf/picorv32/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/cliffordwolf/picorv32/issues/33/comments","events_url":"https://api.github.com/repos/cliffordwolf/picorv32/issues/33/events","html_url":"https://github.com/cliffordwolf/picorv32/issues/33","id":209085827,"number":33,"title":"jal instruction execution doesn't align with expectation","user":{"login":"songchengwei","id":21306385,"avatar_url":"https://avatars.githubusercontent.com/u/21306385?v=3","gravatar_id":"","url":"https://api.github.com/users/songchengwei","html_url":"https://github.com/songchengwei","followers_url":"https://api.github.com/users/songchengwei/followers","following_url":"https://api.github.com/users/songchengwei/following{/other_user}","gists_url":"https://api.github.com/users/songchengwei/gists{/gist_id}","starred_url":"https://api.github.com/users/songchengwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songchengwei/subscriptions","organizations_url":"https://api.github.com/users/songchengwei/orgs","repos_url":"https://api.github.com/users/songchengwei/repos","events_url":"https://api.github.com/users/songchengwei/events{/privacy}","received_events_url":"https://api.github.com/users/songchengwei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"cliffordwolf","id":619764,"avatar_url":"https://avatars.githubusercontent.com/u/619764?v=3","gravatar_id":"","url":"https://api.github.com/users/cliffordwolf","html_url":"https://github.com/cliffordwolf","followers_url":"https://api.github.com/users/cliffordwolf/followers","following_url":"https://api.github.com/users/cliffordwolf/following{/other_user}","gists_url":"https://api.github.com/users/cliffordwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/cliffordwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cliffordwolf/subscriptions","organizations_url":"https://api.github.com/users/cliffordwolf/orgs","repos_url":"https://api.github.com/users/cliffordwolf/repos","events_url":"https://api.github.com/users/cliffordwolf/events{/privacy}","received_events_url":"https://api.github.com/users/cliffordwolf/received_events","type":"User","site_admin":false},"assignees":[{"login":"cliffordwolf","id":619764,"avatar_url":"https://avatars.githubusercontent.com/u/619764?v=3","gravatar_id":"","url":"https://api.github.com/users/cliffordwolf","html_url":"https://github.com/cliffordwolf","followers_url":"https://api.github.com/users/cliffordwolf/followers","following_url":"https://api.github.com/users/cliffordwolf/following{/other_user}","gists_url":"https://api.github.com/users/cliffordwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/cliffordwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cliffordwolf/subscriptions","organizations_url":"https://api.github.com/users/cliffordwolf/orgs","repos_url":"https://api.github.com/users/cliffordwolf/repos","events_url":"https://api.github.com/users/cliffordwolf/events{/privacy}","received_events_url":"https://api.github.com/users/cliffordwolf/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-02-21T09:26:15Z","updated_at":"2017-02-23T08:19:58Z","closed_at":null,"body":"Hi, Clifford\r\n\r\nWhen I simulate picorv32 with my system, the jal instruction does't jump the the expected address.\r\n![image](https://cloud.githubusercontent.com/assets/21306385/23157864/c63436b4-f857-11e6-8a2b-56e66dddb86e.png)\r\n\r\nas you can see from the waveform, when the current pc is 0x512, cpu get a jal instruction, the value is 0xbfdd in the objdump:\r\n\r\n512: bfdd     j   508 <main+0x8>, \r\n\r\nsince main starts at 0x500, I expect the pc jump to 0x508, however, it jumps to 0x1508, the variable decoded_imm_uj is 0xff6, when it adds to 0x512, the result is 0x1508, should we just use the lower 12 bits to generate reg_next_pc?  \r\n\r\nCould you please have a look at this? Thank you very much!\r\n\r\nlog.txt is the simulation log when add DEBUY macro for picorv32\r\nmem.txt is the memory initialization file\r\n\r\n[log.txt](https://github.com/cliffordwolf/picorv32/files/789630/log.txt)\r\n[mem.txt](https://github.com/cliffordwolf/picorv32/files/789629/mem.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/cliffordwolf/picorv32/issues/comments/281925390","html_url":"https://github.com/cliffordwolf/picorv32/issues/33#issuecomment-281925390","issue_url":"https://api.github.com/repos/cliffordwolf/picorv32/issues/33","id":281925390,"user":{"login":"songchengwei","id":21306385,"avatar_url":"https://avatars.githubusercontent.com/u/21306385?v=3","gravatar_id":"","url":"https://api.github.com/users/songchengwei","html_url":"https://github.com/songchengwei","followers_url":"https://api.github.com/users/songchengwei/followers","following_url":"https://api.github.com/users/songchengwei/following{/other_user}","gists_url":"https://api.github.com/users/songchengwei/gists{/gist_id}","starred_url":"https://api.github.com/users/songchengwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songchengwei/subscriptions","organizations_url":"https://api.github.com/users/songchengwei/orgs","repos_url":"https://api.github.com/users/songchengwei/repos","events_url":"https://api.github.com/users/songchengwei/events{/privacy}","received_events_url":"https://api.github.com/users/songchengwei/received_events","type":"User","site_admin":false},"created_at":"2017-02-23T08:19:58Z","updated_at":"2017-02-23T08:19:58Z","body":"Hi, Clifford\r\n\r\nI use a simple testbench to reproduce the scenario, there is no io, cpu is the only dut. All the related files are packed in the attached file.\r\n\r\nAs you can see in the waveform, when jump instruction is received, the reg_pc jump from 0x4f0 to 0x14e6, where I think it should jumb to 0x4e6.\r\n\r\nCould you please have a look at this?\r\n\r\n![image](https://cloud.githubusercontent.com/assets/21306385/23250348/a093a6fa-f9e3-11e6-9f80-0fa58351eb29.png)\r\n\r\n[picorv32.tar.gz](https://github.com/cliffordwolf/picorv32/files/795866/picorv32.tar.gz)\r\n"}}
{"actor":{"display_login":"songchengwei"}}