<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://old.hacdc.org/index.php?action=history&amp;feed=atom&amp;title=FPGAWorkshop16Notes</id>
	<title>FPGAWorkshop16Notes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://old.hacdc.org/index.php?action=history&amp;feed=atom&amp;title=FPGAWorkshop16Notes"/>
	<link rel="alternate" type="text/html" href="https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;action=history"/>
	<updated>2026-05-07T15:00:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;diff=6744&amp;oldid=prev</id>
		<title>ITechGeek at 17:04, 3 April 2012</title>
		<link rel="alternate" type="text/html" href="https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;diff=6744&amp;oldid=prev"/>
		<updated>2012-04-03T17:04:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:04, 3 April 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:FPGAWorkshop]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;this is known broke - will&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;this is known broke - will&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key hacdc_wiki:diff::1.12:old-2964:rev-6744 --&gt;
&lt;/table&gt;</summary>
		<author><name>ITechGeek</name></author>
	</entry>
	<entry>
		<id>https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;diff=2964&amp;oldid=prev</id>
		<title>69.17.39.162 at 02:43, 17 February 2010</title>
		<link rel="alternate" type="text/html" href="https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;diff=2964&amp;oldid=prev"/>
		<updated>2010-02-17T02:43:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:43, 17 February 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;this is known broke - will&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;//////////////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;//////////////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key hacdc_wiki:diff::1.12:old-2963:rev-2964 --&gt;
&lt;/table&gt;</summary>
		<author><name>69.17.39.162</name></author>
	</entry>
	<entry>
		<id>https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;diff=2963&amp;oldid=prev</id>
		<title>69.17.39.162: Created page with &#039;&lt;pre&gt; ////////////////////////////////////////////////////////////////////////////////// // Company:  // Engineer:  //  // Create Date:    11:23:27 01/28/2010  // Design Name:  /…&#039;</title>
		<link rel="alternate" type="text/html" href="https://old.hacdc.org/index.php?title=FPGAWorkshop16Notes&amp;diff=2963&amp;oldid=prev"/>
		<updated>2010-02-17T00:45:22Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;lt;pre&amp;gt; ////////////////////////////////////////////////////////////////////////////////// // Company:  // Engineer:  //  // Create Date:    11:23:27 01/28/2010  // Design Name:  /…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Company: &lt;br /&gt;
// Engineer: &lt;br /&gt;
// &lt;br /&gt;
// Create Date:    11:23:27 01/28/2010 &lt;br /&gt;
// Design Name: &lt;br /&gt;
// Module Name:    frequency_counter &lt;br /&gt;
// Project Name: &lt;br /&gt;
// Target Devices: &lt;br /&gt;
// Tool versions:  &lt;br /&gt;
// Description: Verilog implementatino of the frequency counter reference&lt;br /&gt;
// design from Xilinx for Spartan 3E Starter Kit&lt;br /&gt;
//&lt;br /&gt;
// Dependencies: &lt;br /&gt;
//&lt;br /&gt;
// Revision: &lt;br /&gt;
// Revision 0.01 - File Created&lt;br /&gt;
// Additional Comments: &lt;br /&gt;
//&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
module frequency_counter(&lt;br /&gt;
    output [7:0] led,&lt;br /&gt;
    input [4:0] sw,&lt;br /&gt;
    output strataflash_oe,&lt;br /&gt;
    output strataflash_ce,&lt;br /&gt;
    output strataflash_we,&lt;br /&gt;
    inout [7:4] lcd_d,&lt;br /&gt;
    output lcd_rs,&lt;br /&gt;
    output lcd_rw,&lt;br /&gt;
    output lcd_e,&lt;br /&gt;
    input sma_clk,&lt;br /&gt;
    input clk_50mhz&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
	// signals for counting the test clock&lt;br /&gt;
	reg [3:0] ab_switch_delay;&lt;br /&gt;
	reg a_count_ce, b_count_ce;&lt;br /&gt;
	reg [31:0] a_count, b_count;&lt;br /&gt;
	reg a_count_rst, b_count_rst;&lt;br /&gt;
	reg freq_for_measurement;&lt;br /&gt;
	wire test_clk;&lt;br /&gt;
	&lt;br /&gt;
	// signals for 1 second interrupt generation and couter switching&lt;br /&gt;
	reg ab_switch;	&lt;br /&gt;
	reg [99:0] interrupt_delay;&lt;br /&gt;
	reg [25:0] one_second_count;&lt;br /&gt;
	reg one_second_pulse;&lt;br /&gt;
	reg interrupt;&lt;br /&gt;
	reg [7:0] source_control;&lt;br /&gt;
&lt;br /&gt;
	// signals for processor interconnect&lt;br /&gt;
	reg [7:0] in_port;&lt;br /&gt;
	wire [7:0] out_port;&lt;br /&gt;
	wire write_strobe, read_strobe;&lt;br /&gt;
	wire [7:0] port_id;&lt;br /&gt;
	wire interrupt_ack;&lt;br /&gt;
	wire [17:0] instruction;&lt;br /&gt;
	wire [9:0] address;&lt;br /&gt;
&lt;br /&gt;
	// lcd wires&lt;br /&gt;
	reg [7:0] lcd_reg;&lt;br /&gt;
	wire lcd_drive;&lt;br /&gt;
	wire lcd_output_data;&lt;br /&gt;
&lt;br /&gt;
	// led reg&lt;br /&gt;
	reg [7:0] led_reg;&lt;br /&gt;
&lt;br /&gt;
	// ring osscillator instantiations&lt;br /&gt;
	ring_osc logic_oscillator (.reset(source_control[6]),.osc_out(ring_oscillator));&lt;br /&gt;
	ring_osc2 logic_oscillator2 (.reset(source_control[6]),.osc_out(ring_oscillator2));&lt;br /&gt;
&lt;br /&gt;
	// frequency selection mux - purely combinational&lt;br /&gt;
	always@(sma_clk or clk_50mhz or ring_oscillator or ring_oscillator2)&lt;br /&gt;
		if(source_control[1:0] == 2&amp;#039;b00)&lt;br /&gt;
			freq_for_measurement = sma_clk;&lt;br /&gt;
		else if(source_control[1:0] == 2&amp;#039;b01)&lt;br /&gt;
			freq_for_measurement = clk_50mhz;&lt;br /&gt;
		else if(source_control[1:0] == 2&amp;#039;b10)&lt;br /&gt;
			freq_for_measurement = ring_oscillator2;&lt;br /&gt;
		else&lt;br /&gt;
			freq_for_measurement = ring_oscillator;&lt;br /&gt;
&lt;br /&gt;
	// global clock buffer the test clock		&lt;br /&gt;
	BUFG buffer_clkin(.O(test_clk), .I(freq_for_measurement));		&lt;br /&gt;
&lt;br /&gt;
	// counter switch control&lt;br /&gt;
	always@(posedge test_clk)		&lt;br /&gt;
	begin&lt;br /&gt;
		ab_switch_delay &amp;lt;= {ab_switch_delay[2:0], ab_switch};&lt;br /&gt;
		case(ab_switch_delay[3:1])&lt;br /&gt;
			3&amp;#039;b000: begin&lt;br /&gt;
				a_count_ce &amp;lt;= 1;&lt;br /&gt;
				b_count_ce &amp;lt;= 0;&lt;br /&gt;
				end&lt;br /&gt;
			3&amp;#039;b111: begin&lt;br /&gt;
				a_count_ce &amp;lt;= 0;&lt;br /&gt;
				b_count_ce &amp;lt;= 1;&lt;br /&gt;
			end&lt;br /&gt;
			default: begin&lt;br /&gt;
				a_count_ce &amp;lt;= 1;&lt;br /&gt;
				b_count_ce &amp;lt;= 0;&lt;br /&gt;
			end&lt;br /&gt;
		endcase&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	// test counters&lt;br /&gt;
	always@(posedge test_clk or posedge a_count_rst)&lt;br /&gt;
		if(a_count_rst)&lt;br /&gt;
			a_count &amp;lt;= &amp;#039;b0;&lt;br /&gt;
		else if(a_count_ce)&lt;br /&gt;
			a_count &amp;lt;= a_count+1;&lt;br /&gt;
		else&lt;br /&gt;
			a_count &amp;lt;= a_count;&lt;br /&gt;
&lt;br /&gt;
	always@(posedge test_clk or posedge b_count_rst)&lt;br /&gt;
		if(b_count_rst)&lt;br /&gt;
			b_count &amp;lt;= &amp;#039;b0;&lt;br /&gt;
		else if(b_count_ce)&lt;br /&gt;
			b_count &amp;lt;= b_count+1;&lt;br /&gt;
		else&lt;br /&gt;
			b_count &amp;lt;= b_count;	&lt;br /&gt;
&lt;br /&gt;
	// one second interrupt generation and clock switching&lt;br /&gt;
/*	always@(posedge clk_50mhz)&lt;br /&gt;
	begin&lt;br /&gt;
		// divide by 50,000,000 to generate pulse&lt;br /&gt;
		if(one_second_count == 26&amp;#039;d49999999)&lt;br /&gt;
		begin&lt;br /&gt;
			one_second_count &amp;lt;= &amp;#039;b0;&lt;br /&gt;
			one_second_pulse &amp;lt;= 1&amp;#039;b1;&lt;br /&gt;
		end&lt;br /&gt;
		else&lt;br /&gt;
		begin&lt;br /&gt;
			one_second_count &amp;lt;= one_second_count + 1;&lt;br /&gt;
			one_second_pulse &amp;lt;= 1&amp;#039;b0;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		// delay 100 clock cycles before generating interrupt&lt;br /&gt;
		interrupt_delay &amp;lt;= {interrupt_delay[98:0], one_second_pulse};&lt;br /&gt;
		&lt;br /&gt;
		// interrupt generation&lt;br /&gt;
		if (interrupt_ack == 1&amp;#039;b1)&lt;br /&gt;
			interrupt &amp;lt;= 1&amp;#039;b0;&lt;br /&gt;
		else if (interrupt_delay[99] == 1&amp;#039;b1)&lt;br /&gt;
			interrupt &amp;lt;= 1&amp;#039;b1;&lt;br /&gt;
		else&lt;br /&gt;
			interrupt &amp;lt;= interrupt;&lt;br /&gt;
			&lt;br /&gt;
		// counter selection switch toggle&amp;#039;s each second&lt;br /&gt;
		if (one_second_pulse == 1&amp;#039;b1)&lt;br /&gt;
			ab_switch &amp;lt;= ~ab_switch;&lt;br /&gt;
	end*/&lt;br /&gt;
always@(posedge clk_50mhz)&lt;br /&gt;
	begin&lt;br /&gt;
		// divide by 50,000,000 to generate pulse&lt;br /&gt;
		if(one_second_count == 26&amp;#039;d49999999)&lt;br /&gt;
		begin&lt;br /&gt;
			one_second_count &amp;lt;= &amp;#039;b0;&lt;br /&gt;
			one_second_pulse &amp;lt;= 1&amp;#039;b1;&lt;br /&gt;
		end&lt;br /&gt;
		else&lt;br /&gt;
		begin&lt;br /&gt;
			one_second_count &amp;lt;= one_second_count + 1;&lt;br /&gt;
			one_second_pulse &amp;lt;= 1&amp;#039;b0;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
always@(posedge clk_50mhz)&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
			// delay 100 clock cycles before generating interrupt&lt;br /&gt;
		interrupt_delay &amp;lt;= {interrupt_delay[98:0], one_second_pulse};&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
always@(posedge clk_50mhz)&lt;br /&gt;
	begin&lt;br /&gt;
			// interrupt generation&lt;br /&gt;
		if (interrupt_ack == 1&amp;#039;b1)&lt;br /&gt;
			interrupt &amp;lt;= 1&amp;#039;b0;&lt;br /&gt;
		else if (interrupt_delay[99] == 1&amp;#039;b1)&lt;br /&gt;
			interrupt &amp;lt;= 1&amp;#039;b1;&lt;br /&gt;
		else&lt;br /&gt;
			interrupt &amp;lt;= interrupt;&lt;br /&gt;
end		&lt;br /&gt;
&lt;br /&gt;
always@(posedge clk_50mhz)&lt;br /&gt;
begin&lt;br /&gt;
	// counter selection switch toggle&amp;#039;s each second&lt;br /&gt;
		if (one_second_pulse == 1&amp;#039;b1)&lt;br /&gt;
			ab_switch &amp;lt;= ~ab_switch;&lt;br /&gt;
		else&lt;br /&gt;
			ab_switch &amp;lt;= ab_switch;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
	// picoblaze instantiation&lt;br /&gt;
	kcpsm3 processor (.address(address), &lt;br /&gt;
		.instruction(instruction),&lt;br /&gt;
		.port_id(port_id),&lt;br /&gt;
		.write_strobe(write_strobe),&lt;br /&gt;
		.out_port(out_port),&lt;br /&gt;
		.read_strobe(read_strobe),&lt;br /&gt;
		.in_port(in_port),&lt;br /&gt;
		.interrupt(interrupt),&lt;br /&gt;
		.interrupt_ack(interrupt_ack),&lt;br /&gt;
		.reset(reset),&lt;br /&gt;
		.clk(clk_50mhz));&lt;br /&gt;
	fc_ctrl program_rom (.address(address),&lt;br /&gt;
		.instruction(instruction),&lt;br /&gt;
		.proc_reset(proc_reset),&lt;br /&gt;
		.clk(clk_50mhz));&lt;br /&gt;
		&lt;br /&gt;
	// processor input ports&lt;br /&gt;
	always@ (posedge clk_50mhz)&lt;br /&gt;
		case(port_id[7:4])&lt;br /&gt;
			// read A counter&lt;br /&gt;
			4&amp;#039;b0000: in_port &amp;lt;= a_count[7:0];&lt;br /&gt;
			4&amp;#039;b0001: in_port &amp;lt;= a_count[15:8];&lt;br /&gt;
			4&amp;#039;b0010: in_port &amp;lt;= a_count[23:16];&lt;br /&gt;
			4&amp;#039;b0011: in_port &amp;lt;= a_count[31:24];			&lt;br /&gt;
			// read B counter&lt;br /&gt;
			4&amp;#039;b0100: in_port &amp;lt;= b_count[7:0];&lt;br /&gt;
			4&amp;#039;b0101: in_port &amp;lt;= b_count[15:8];&lt;br /&gt;
			4&amp;#039;b0110: in_port &amp;lt;= b_count[23:16];&lt;br /&gt;
			4&amp;#039;b0111: in_port &amp;lt;= b_count[31:24];		&lt;br /&gt;
			// read slide switches&lt;br /&gt;
			4&amp;#039;b1000: in_port &amp;lt;= {3&amp;#039;b000, ab_switch, sw};&lt;br /&gt;
			// read LC Ddata at address 90 hex&lt;br /&gt;
			4&amp;#039;b1001: in_port &amp;lt;= {lcd_d, 4&amp;#039;b0000};&lt;br /&gt;
			// original design used a dont care condition&lt;br /&gt;
			// I&amp;#039;ve decided to let it retain its value.&lt;br /&gt;
			default: in_port &amp;lt;= in_port;&lt;br /&gt;
		endcase	&lt;br /&gt;
	&lt;br /&gt;
	// output ports&lt;br /&gt;
	always@ (posedge clk_50mhz)&lt;br /&gt;
		if(write_strobe)&lt;br /&gt;
			case(port_id[3:0])&lt;br /&gt;
				// LED register at address 0x01&lt;br /&gt;
				4&amp;#039;b0001: led_reg &amp;lt;= out_port;&lt;br /&gt;
				// Counter reset controls at 0x02&lt;br /&gt;
				4&amp;#039;b0010: begin&lt;br /&gt;
					a_count_rst &amp;lt;= out_port[0];&lt;br /&gt;
					b_count_rst &amp;lt;= out_port[1];&lt;br /&gt;
					end&lt;br /&gt;
				// LCD data/controls at 0x04&lt;br /&gt;
				4&amp;#039;b0100: begin&lt;br /&gt;
					lcd_reg			&amp;lt;= out_port;&lt;br /&gt;
					end&lt;br /&gt;
				// Source selection and control at 0x08&lt;br /&gt;
				4&amp;#039;b1000: source_control &amp;lt;= out_port;&lt;br /&gt;
			endcase&lt;br /&gt;
&lt;br /&gt;
	// LCD controls&lt;br /&gt;
	assign lcd_rw_control = lcd_reg[1];&lt;br /&gt;
	assign lcd_drive = lcd_reg[3];&lt;br /&gt;
	assign lcd_output_data = lcd_reg [7:4];&lt;br /&gt;
	// LCD Outputs&lt;br /&gt;
	assign lcd_e = lcd_reg[0];&lt;br /&gt;
	assign lcd_rw = lcd_rw_control &amp;amp;&amp;amp; lcd_drive;&lt;br /&gt;
	assign lcd_rs = lcd_reg[2];&lt;br /&gt;
	assign lcd_d = ((lcd_rw_control == 1&amp;#039;b0) &amp;amp;&amp;amp; (lcd_drive == 1&amp;#039;b1)) ? lcd_output_data : 4&amp;#039;bZZZZ;&lt;br /&gt;
	&lt;br /&gt;
	// LED assignment&lt;br /&gt;
	//assign led = led_reg;&lt;br /&gt;
	// Debug assignments&lt;br /&gt;
	assign led[7]=led_reg[7]; //A counter&lt;br /&gt;
	assign led[6]=led_reg[0]; //B counter&lt;br /&gt;
	assign led[5]=a_count[10]; // should toggle at 8hz when enabled&lt;br /&gt;
	assign led[4]=b_count[10]; // should toggle at 8hz when enabled&lt;br /&gt;
	assign led[3]=one_second_count[24]; // should toggle very fast.&lt;br /&gt;
	assign led[2]=one_second_pulse; // once per second&lt;br /&gt;
	assign led[1]=interrupt_ack; //interrupt ack&lt;br /&gt;
	assign led[0]=interrupt; //interrupt&lt;br /&gt;
&lt;br /&gt;
	// strataflash chip enable signals to disable onboard strataflash&lt;br /&gt;
	assign strataflash_we = 1&amp;#039;b1;&lt;br /&gt;
	assign strataflash_ce = 1&amp;#039;b1;&lt;br /&gt;
	assign strataflash_oe = 1&amp;#039;b1;&lt;br /&gt;
&lt;br /&gt;
endmodule&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>69.17.39.162</name></author>
	</entry>
</feed>