-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement EMCU primitive #279
Draft
yrabbit
wants to merge
4
commits into
YosysHQ:master
Choose a base branch
from
yrabbit:emcu
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In this PR we add the ARM Cortex M3 microcontroller integrated in the GW1NSR-4C chip that powers the Sipeed TangNano 4K. This primitive represents the microprocessor itself, but you need to add ROM (flash), RAM, and some I/O to it for proper operation. Luckily we have working flash, BSRAM and IOBUFs :) The examples will show how to use this EMCU in the simplest cases. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
I'll add a couple more examples, but actually they won't go through compilation yet - wait for |
It shows the practical minimum of It shows the practical minimum of the components that need to be added to the EMCU primitive to get a working system. You can use more memory addressing lines thereby increasing its volume with the current 4K, as well as those who wish can make an APB bus to communicate with other devices. Firmware compilation is very difficult, but there is a good description: https://github.com/verilog-indeed/gowin_fpga_tutorials/tree/main/gowin_empu Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
It blinks with the LED that on the board, MODE but what can you do. blinky.mp4 |
Use first UART of the Cortex-M3 emcu for text adventure-like game. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
The processor built into the GW1NSR-4C can communicate with the outside world using another mechanism besides the Flash, memory and GPIO buses - this is the Advanced Peripheral Bus (APB). APB is part of the Advanced Microcontroller Bus Architecture hierarchy of buses and is optimized for minimal power consumption and reduced interface complexity. APB should be used to interface to any peripherals which are low-bandwidth and do not require the high performance of a piplined bus interface. Strictly speaking, according to the specification there must be a bridge between the high-speed AHB bus and the APB bus, among the functions of which are device selection (PSELx), generation of the PENABLE signal and holding of values on the address bus. And if PSELx signals have to be generated, there is no question, the EMCU primitive already has a PENABLE output. So I took the liberty and did not implement the latching of address lines, so the bridge turned out to be very small: ``` verilog wire psel1; assign psel1 = apbtargexp2_psel && (apbtargexp2_paddr[11:8] == 4'h4); // 0x40002 >4< 00 ``` Here I compare to the address of the first device - 0x40002400, there are 12 such devices with base addresses spaced 256 bytes apart (this does not cover the entire range of the 4 high bits of the APB address bus, so there are probably some unknown devices with fixed addresses). I don't use the [7:0] address bits in this example, but it's actually a very useful thing to implement the registers of a particular peripheral. The exchange is done in 32-bit words so 64 registers per device. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR we add the ARM Cortex M3 microcontroller integrated in the GW1NSR-4C chip that powers the Sipeed TangNano 4K.
This primitive represents the microprocessor itself, but you need to add ROM (flash), RAM, and some I/O to it for proper operation.
Luckily we have working flash, BSRAM and IOBUFs :)
The examples will show how to use this EMCU in the simplest cases.