source ipcore_dir/microblaze_mcs_setup.tcl
microblaze_mcs_data2mem SDK/Atlys_LED_Test/Debug/Atlys_LED_Test.elf
//
// Atlys_LED_test.c
//
// AltysボードのLEDを1秒ごとに+1するソフトウェア
// 初めは割り込みを使わないで実行する
//
#define GPIO1_ADDR 0x80000010
#define PIT1_PRELOAD_ADDR 0x80000040
#define PIT1_COUNTER_ADDR 0x80000044
#define PIT1_CONTROL_ADDR 0x80000048
unsigned int read_counter(){
return(*(volatile unsigned int *)(PIT1_COUNTER_ADDR));
}
int main()
{
unsigned int b_count = 0;
unsigned int c_count = 0;
unsigned int led = 0x55;
*(volatile unsigned int *)(PIT1_PRELOAD_ADDR) = 10; // 100MHzで1秒
*(volatile unsigned int *)(PIT1_CONTROL_ADDR) = 0x3; // Timer Enable, Auto load
*(volatile unsigned int *)(GPIO1_ADDR) = led;
while(1){
c_count = read_counter();
*(volatile unsigned int *)(GPIO1_ADDR) = c_count;
if (c_count > b_count){ // 現在の値のほうが大きいのでオートロードした
*(volatile unsigned int *)(GPIO1_ADDR) = led++;
}
*(volatile unsigned int *)(GPIO1_ADDR) = led++;
b_count = c_count;
}
}
module MicroBlaze_MCS_Test(
input wire clk,
input wire reset,
output wire [7:0] LED_out
);
wire PIT1_Interrupt;
wire PIT1_Toggle;
wire INTC_IRQ;
assign reset_n = ! reset;
MB_MCS mcs_0 (
.Clk(clk), // input Clk
.Reset(reset), // input Reset
.PIT1_Enable(1'b1), // input PIT1_Enable
.PIT1_Interrupt(PIT1_Interrupt), // output PIT1_Interrupt
.PIT1_Toggle(PIT1_Toggle), // output PIT1_Toggle
.GPO1(LED_out), // output [7 : 0] GPO1
.INTC_IRQ(INTC_IRQ) // output INTC_IRQ
);
endmodule
`timescale 1ns / 1ps
module MicroBlaze_MCS_Test_tb;
// Inputs
reg clk;
reg reset;
// Outputs
wire [7:0] LED_out;
// Instantiate the Unit Under Test (UUT)
MicroBlaze_MCS_Test uut (
.clk(clk),
.reset(reset),
.LED_out(LED_out)
);
parameter PERIOD = 10; // 100MHz clock
parameter real DUTY_CYCLE = 0.5;
parameter OFFSET = 0;
initial // Clock process for clk
begin
clk = 1'b0;
#OFFSET;
forever begin
clk = 1'b0;
#(PERIOD-(PERIOD*DUTY_CYCLE)) clk = 1'b1;
#(PERIOD*DUTY_CYCLE);
end
end
initial begin
// Initialize Inputs
reset = 1'b1;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
reset = 1'b0;
end
endmodule
NET "LED_out[0]" LOC = U18;
NET "LED_out[1]" LOC = M14;
NET "LED_out[2]" LOC = N14;
NET "LED_out[3]" LOC = L14;
NET "LED_out[4]" LOC = M13;
NET "LED_out[5]" LOC = D4;
NET "LED_out[6]" LOC = P16;
NET "LED_out[7]" LOC = N12;
NET "clk" LOC = L15;
NET "reset" LOC = P3;
NET "LED_out[0]" IOSTANDARD = LVCMOS33;
NET "LED_out[1]" IOSTANDARD = LVCMOS33;
NET "LED_out[2]" IOSTANDARD = LVCMOS33;
NET "LED_out[3]" IOSTANDARD = LVCMOS33;
NET "LED_out[4]" IOSTANDARD = LVCMOS33;
NET "LED_out[5]" IOSTANDARD = LVCMOS33;
NET "LED_out[6]" IOSTANDARD = LVCMOS33;
NET "clk" IOSTANDARD = LVCMOS33;
NET "reset" IOSTANDARD = LVCMOS18;
NET "clk" TNM_NET = "clk";
TIMESPEC TS_sysclk = PERIOD "clk" 10 ns HIGH 50 %;
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |