aboutsummaryrefslogtreecommitdiffstats
path: root/tests/verilog/wire_and_var.sv
blob: 79c7c04c617d0e4fb255d2c5693daf3b295d2bdb (plain)
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
31
32
33
`define TEST(kwd) \
	kwd kwd``_1; \
	kwd kwd``_2; \
	initial kwd``_1 = 1; \
	assign kwd``_2 = 1;

`define TEST_VAR(kwd) \
	var kwd var_``kwd``_1; \
	var kwd var_``kwd``_2; \
	initial var_``kwd``_1 = 1; \
	assign var_``kwd``_2 = 1;

`define TEST_WIRE(kwd) \
	wire kwd wire_``kwd``_1; \
	wire kwd wire_``kwd``_2; \
	initial wire_``kwd``_1 = 1; \
	assign wire_``kwd``_2 = 1;

module top;

`TEST(wire) // wire assigned in a block
`TEST(reg) // reg assigned in a continuous assignment
`TEST(logic)
`TEST(integer)

`TEST_VAR(reg) // reg assigned in a continuous assignment
`TEST_VAR(logic)
`TEST_VAR(integer)

`TEST_WIRE(logic) // wire assigned in a block
`TEST_WIRE(integer) // wire assigned in a block

endmodule
: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
--- a/arch/arm/mach-cns21xx/Kconfig
+++ b/arch/arm/mach-cns21xx/Kconfig
@@ -2,6 +2,15 @@ if ARCH_CNS21XX
 
 menu "Cavium Networks CNS21xx based machines"
 
+config MACH_NSB3AST
+	bool "AGESTAR NSB3AST support"
+	select CNS21XX_DEV_GEC
+	select CNS21XX_DEV_SPI_MASTER
+	select CNS21XX_DEV_USB
+	help
+	  Say Y here if you intend to run this kernel on the
+	  AGESTAR NSB3AST board.
+
 config MACH_NS_K330
 	bool "NS-K330 NAS"
 	select CNS21XX_DEV_GEC
--- /dev/null
+++ b/arch/arm/mach-cns21xx/mach-nsb3ast.c
@@ -0,0 +1,173 @@
+/*
+ *  AGESTAR NSB3AST board support
+ *
+ *  Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ *  This file is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License, Version 2, as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
+
+#include <asm/setup.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/time.h>
+#include <mach/hardware.h>
+#include <mach/cns21xx.h>
+#include <mach/cns21xx_misc.h>
+
+#include "common.h"
+#include "dev-gec.h"
+
+static struct mtd_partition nsb3ast_partitions[] =  {
+	{
+		.name		= "armboot",
+		.offset		= 0x0,
+		.size		= 0x040000,
+		.mask_flags	= MTD_WRITEABLE,
+	}, {
+		.name		= "kernel",
+		.offset		= 0x040000,
+		.size		= 0x100000,
+	}, {
+		.name		= "rootfs",
+		.offset		= 0x140000,
+		.size		= 0x6c0000,
+	}, {
+		.name		= "firmware",
+		.offset		= 0x040000,
+		.size		= 0x7c0000,
+	}, {
+		.name		= "wholeflash",
+		.offset		= 0x0,
+		.size		= 0x800000,
+		.mask_flags	= MTD_WRITEABLE,
+	},
+};
+
+static struct flash_platform_data nsb3ast_flash_data = {
+        .parts          = nsb3ast_partitions,
+        .nr_parts       = ARRAY_SIZE(nsb3ast_partitions),
+};
+
+static struct spi_board_info nsb3ast_spi_board_info[] = {
+	{
+		.bus_num	= 0,
+		.chip_select	= 0,
+		.max_speed_hz	= 25000000,
+		.modalias	= "m25p80",
+		.platform_data	= &nsb3ast_flash_data,
+	}
+};
+
+static struct gpio_led nsb3ast_gpio_leds[] = {
+	{
+		.name		= "nsb3ast:red:d1",
+		.gpio		= 15,
+		.active_low	= 1,
+	}, {
+		.name		= "nsb3ast:amber:eth",
+		.gpio		= 22,
+		.active_low	= 1,
+	}
+};
+
+static struct gpio_led_platform_data nsb3ast_gpio_leds_data = {
+	.num_leds		= ARRAY_SIZE(nsb3ast_gpio_leds),
+	.leds			= nsb3ast_gpio_leds,
+};
+
+static struct platform_device nsb3ast_gpio_leds_device = {
+	.name			= "leds-gpio",
+	.id			= -1,
+	.dev.platform_data	= &nsb3ast_gpio_leds_data,
+};
+
+static struct gpio_keys_button nsb3ast_gpio_keys[] = {
+	{
+		.code		= KEY_RESTART,
+		.gpio		= 0,
+		.desc		= "Reset Button",
+		.active_low	= 1,
+	},
+	{
+		.code		= BTN_0,
+		.gpio		= 2,
+		.desc		= "USB Button",
+		.active_low	= 0,
+	},
+};
+
+static struct gpio_keys_platform_data nsb3ast_gpio_keys_data = {
+	.buttons	= nsb3ast_gpio_keys,
+	.nbuttons	= ARRAY_SIZE(nsb3ast_gpio_keys),
+};
+
+static struct platform_device nsb3ast_gpio_keys_device = {
+	.name		= "gpio-keys",
+	.id		= -1,
+	.num_resources	= 0,
+	.dev		= {
+		.platform_data	= &nsb3ast_gpio_keys_data,
+	},
+};
+
+static void __init nsb3ast_fixup(struct tag *tags, char **cmdline,
+			  	 struct meminfo *mi)
+{
+	struct tag *t;
+
+	/* The board has 32MB of RAM mapped at 0. */
+	mi->nr_banks = 1;
+	mi->bank[0].start = 0;
+	mi->bank[0].size = SZ_32M;
+
+	for (t = tags; t->hdr.size; t = tag_next(t)) {
+		switch (t->hdr.tag) {
+		case ATAG_CORE:
+			if (t->u.core.rootdev == 255)
+				t->u.core.rootdev = 0;
+			break;
+		}
+	}
+}
+
+static void __init nsb3ast_init(void)
+{
+	cns21xx_gpio_init();
+	cns21xx_register_uart0();
+	cns21xx_register_uart1();
+	cns21xx_register_wdt();
+	cns21xx_register_usb();
+	cns21xx_register_spi_master(-1, nsb3ast_spi_board_info,
+				    ARRAY_SIZE(nsb3ast_spi_board_info));
+
+	cns21xx_gec_data.phy_type = CNS21XX_GEC_PHY_TYPE_INTERNAL;
+	cns21xx_register_gec();
+
+	HAL_MISC_DISABLE_LED012_PINS();
+	platform_device_register(&nsb3ast_gpio_leds_device);
+	platform_device_register(&nsb3ast_gpio_keys_device);
+}
+
+MACHINE_START(NSB3AST, "AGESTAR NSB3AST")
+	.fixup		= nsb3ast_fixup,
+	.map_io		= cns21xx_map_io,
+	.init_irq	= cns21xx_init_irq,
+	.timer		= &cns21xx_timer,
+	.init_machine	= nsb3ast_init,
+	.restart	= cns21xx_restart,
+MACHINE_END
--- a/arch/arm/mach-cns21xx/Makefile
+++ b/arch/arm/mach-cns21xx/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_CNS21XX_DEV_SPI_MASTER)	+=
 
 # machine specific files
 obj-$(CONFIG_MACH_NS_K330)		+= mach-ns-k330.o
+obj-$(CONFIG_MACH_NSB3AST)		+= mach-nsb3ast.o