Instead of the Duckworth's approach of creating an IP instantiation template, use the Block Design feature from Vivado which automatically will wire the connections and also the pin numbers. So far I got it working with the traditional Microblaze. Note: this approach requires no writing of code at all! May even work without a UCF file as long as standard board components are used.
Note: you must first install the BASYS3 board files as explained here:Xilinx Vivado Design Suite 15.1.
https://reference.digilentinc.com/arty/gsmb
Mostly based on this but then followed the previous approach for adding ELF files.
1. Create new project and do not specify sources.
2. Select BASYS3 board.
3. Create a new Block Design.
4. Add the Microblaze MCS, double click on it and enable the UART and set it to 32 Kb. (Ignore GIPIO for now.) (Note: couldn’t get Clocking Wizard to work, don’t add it for now.)
5. Run Connection Automation and you get this:
6. Double click on reset and set it to “active High.”
7. Validate design; there should be no errors.
8. In the Sources window, create the HDL Wrapper for your design and Let Vivado do the updates.
9. Generate the Bit Stream – will take a long time. (Maybe should have only done the synthesis but it worked.) Synthesis does the job and is faster.
Here is where it diverges from the Digilent Document; instead of exporting it with the bitstream to SDK we use the same approach as we did before, namely:
10. Export Hardware to SDK but WITHOUT the bitstream
11. Launch SDK
12. In SDK launch the application project “Hello World.”
13. Back in Vivado Associate ELF file. (Similar to before.)
14. Generate Bitstream
15. Program the device (make sure you create and open a Terminal port first in SDK.)
Works, see project7. 6/9/16
16. Added LEDs and Switches to above; see below.
17. Validated with no errors.
18. Added the Design Wrapper
19. Run Synthesis (Only) this time.
20. Export to SDK / overwrite existing file.
21. With SDK open, let it update its board files and then add the following code to send switch input to leds:
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h" // add
#include "xiomodule.h" // add
int main()
{
init_platform();
print("Hello yap1\n\r");
u32 data;
XIOModule gpi;
XIOModule gpo;
data = XIOModule_Initialize(&gpi, XPAR_IOMODULE_0_DEVICE_ID);
data = XIOModule_Start(&gpi);
data = XIOModule_Initialize(&gpo, XPAR_IOMODULE_0_DEVICE_ID);
data = XIOModule_Start(&gpo);
while (1)
{
data = XIOModule_DiscreteRead(&gpi, 2); // read switches (channel 2)
XIOModule_DiscreteWrite(&gpo, 1, data); // turn on LEDs (channel 1)
}
cleanup_platform();
return 0;
}
//Note: for input channel 1 was used instead of usually 1!!!!!!!!!!!!
22. In Vivado, generate bit file and program.
Below is the Vivado generated Design Wrapper:
`timescale 1 ps / 1 ps
module design_1_wrapper
(dip_switches_16bits_tri_i,
led_16bits_tri_o,
reset,
sys_clock,
usb_uart_rxd,
usb_uart_txd);
input [15:0]dip_switches_16bits_tri_i;
output [15:0]led_16bits_tri_o;
input reset;
input sys_clock;
input usb_uart_rxd;
output usb_uart_txd;
wire [15:0]dip_switches_16bits_tri_i;
wire [15:0]led_16bits_tri_o;
wire reset;
wire sys_clock;
wire usb_uart_rxd;
wire usb_uart_txd;
design_1 design_1_i
(.dip_switches_16bits_tri_i(dip_switches_16bits_tri_i),
.led_16bits_tri_o(led_16bits_tri_o),
.reset(reset),
.sys_clock(sys_clock),
.usb_uart_rxd(usb_uart_rxd),
.usb_uart_txd(usb_uart_txd));
endmodule
Works Works, see project7. 6/9/16
When instantiating the Digital Clock manager it produces two output ports named clk_out1 and locked. However, using the block design, these cannot be directly mapped to an LED or the JA connector. Instead, they must be declared as an external port and then they can be listed in the UCF file and linked. See the example below
XDC File: (All others commented out)
#Pmod Header JA
##Sch name = JA1
set_property PACKAGE_PIN J1 [get_ports clk_out1]
set_property IOSTANDARD LVCMOS33 [get_ports clk_out1]
#Sch name = JA2
set_property PACKAGE_PIN L2 [get_ports locked]
set_property IOSTANDARD LVCMOS33 [get_ports locked]
Note: was able to get an output up to 350 MHz with the clocking wizard. Above that, you still get an output but either because of cable limitations or output drive power, signal doesn't look very convincing.
(Not sure why reset wasn't set to active LO???)
See Project_17a (Vivado 16.2)
Simple Hello World project with Microblaze MCS microprocessor.
This design successfully tested the clock wizard with a 32kB Microblaze MCS. You must set the "reset" port to Active High. Most of the connections (except the UART) had to be wired by hand for it to work but no UCF file was required and it worked fine with the Hello World program.
Programming Sequence
Open Project; do not specify source; add BASYS3 board.
Create Block Design and drag System Clock from the Board panel
Run Connection Automation and then double click on "reset" and set it Active High.
Run Validation; should be successful.
Add IP Microblaze MCS; double click and set in MCS options Memory Size to 32 kB.
Back in Board panel drag USB UART into block design; (Note: UART has not been previously activated in the MCS design); double click on the microblaze and set UART baud rate to 115000 bauds.
Run Connection Automation; verify design; should get errors regarding reset; change reset once more reset to active high.
Also change the design, i.e., delete the existing line from the sys_clk to the clk of the MP, so that the MP is clocked from clocking wizard as shown above.
Verify design. There should be no errors.
Go to Sources and right click don design_1 and select Create Design Wrapper.
Run synthesis
File / Export Hardware but do not include bitstream.
File Launch SDK.
In SDK, File / New Application Project; give it a name, select Next and then select "Hello World." Modify the print statement to make sure it works.
Back in Vivado, select Tools / Associate Elf file and find the elf file in the ....sdk/xxxx/Debug/ folder.
Generate the the bitstream.
Before transferring the bitstream, open a telnet program, such as SecureCRT and connect to the USB port with 115 000 baud. When it is complete open the hardware manager and program device. You should see the message sent in the print statement.
(Note: pressing reset, i.e., center button doesn't seem to do a lot.)