Electronic Dice VHDL Program

A

Amstel

Guest
I did an electronic dice game ( 3 die ) program in VHDL. Basically ,
the program has 216 different dice values combinations which was
simply assigned by me. The dice has 3 segment displays . I defined the
3 displays as output " seg " .
However , I can't figured out any idea to write this electronic dice (
3 die )program using the function " Random Number Generator " where
the dice can get random combinations randomly which means I don't have
to assign the 216 dice combintions .
Anyone have any idea how to write the program ? Perhaps write the
beginning part of the program so that I could roughly have an idea to
continue from there.
I appreciate your help.

Thanks a lot .

Below is my program:

--------------------------------------------------------------------------------


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity dice is port(
reset,clk : in std_logic;
seg: out std_logic_vector (20 downto 0));
end dice;

architecture archdice of dice is

type dice_states is
(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,
s18,s19,s20,s21,s22,s23,s24,s25,s26,s27,s28,s29,s30,s31,s32,
s33,s34,s35,s36,s37,s38,s39,s40,s41,s42,s43,s44,s45,s46,s47,
s48,s49,s50,s51,s52,s53,s54,s55,s56,s57,s58,s59,s60,s61,s62,
s63,s64,s65,s66,s67,s68,s69,s70,s71,s72,s73,s74,s75,s76,s77,
s78,s79,s80,s81,s82,s83,s84,s85,s86,s87,s88,s89,s90,s91,s92,
s93,s94,s95,s96,s97,s98,s99,s100,s101,s102,s103,s104,s105,
s106,s107,s108,s109,s110,s111,s112,s113,s114,s115,s116,s117,
s118,s119,s120,s121,s122,s123,s124,s125,s126,s127,s128,s129,
s130,s131,s132,s133,s134,s135,s136,s137,s138,s139,s140,s141,
s142,s143,s144,s145,s146,s147,s148,s149,s150,s151,s152,s153,
s154,s155,s156,s157,s158,s159,s160,s161,s162,s163,s164,s165,
s166,s167,s168,s169,s170,s171,s172,s173,s174,s175,s176,s177,
s178,s179,s180,s181,s182,s183,s184,s185,s186,s187,s188,s189,
s190,s191,s192,s193,s194,s195,s196,s197,s198,s199,s200,s201,
s202,s203,s204,s205,s206,s207,s208,s209,s210,s211,s212,s213,
s214,s215,s216);

signal sm: dice_states;

begin

process (sm,clk)
begin
if reset = '1' then
sm <= s1;
elsif (clk'event and clk = '1' ) then

case sm is
when s1 => sm <= s2;
when s2 => sm <= s3;
when s3 => sm <= s4;
when s4 => sm <= s5;
when s5 => sm <= s6;
when s6 => sm <= s7;
when s7 => sm <= s8;
when s8 => sm <= s9;
when s9 => sm <= s10;
when s10 => sm <= s11;
when s11 => sm <= s12;
when s12 => sm <= s13;
when s13 => sm <= s14;
when s14 => sm <= s15;
when s15 => sm <= s16;
when s16 => sm <= s17;
when s17 => sm <= s18;
when s18 => sm <= s19;
when s19 => sm <= s20;
when s20 => sm <= s21;
when s21 => sm <= s22;
when s22 => sm <= s23;
when s23 => sm <= s24;
when s24 => sm <= s25;
when s25 => sm <= s26;
when s26 => sm <= s27;
when s27 => sm <= s28;
when s28 => sm <= s29;
when s29 => sm <= s30;
when s30 => sm <= s31;
when s31 => sm <= s32;
when s32 => sm <= s33;
when s33 => sm <= s34;
when s34 => sm <= s35;
when s35 => sm <= s36;
when s36 => sm <= s37;
when s37 => sm <= s38;
when s38 => sm <= s39;
when s39 => sm <= s40;
when s40 => sm <= s41;
when s41 => sm <= s42;
when s42 => sm <= s43;
when s43 => sm <= s44;
when s44 => sm <= s45;
when s45 => sm <= s46;
when s46 => sm <= s47;
when s47 => sm <= s48;
when s48 => sm <= s49;
when s49 => sm <= s50;
when s50 => sm <= s51;
when s51 => sm <= s52;
when s52 => sm <= s53;
when s53 => sm <= s54;
when s54 => sm <= s55;
when s55 => sm <= s56;
when s56 => sm <= s57;
when s57 => sm <= s58;
when s58 => sm <= s59;
when s59 => sm <= s60;
when s60 => sm <= s61;
when s61 => sm <= s62;
when s62 => sm <= s63;
when s63 => sm <= s64;
when s64 => sm <= s65;
when s65 => sm <= s66;
when s66 => sm <= s67;
when s67 => sm <= s68;
when s68 => sm <= s69;
when s69 => sm <= s70;
when s70 => sm <= s71;
when s71 => sm <= s72;
when s72 => sm <= s73;
when s73 => sm <= s74;
when s74 => sm <= s75;
when s75 => sm <= s76;
when s76 => sm <= s77;
when s77 => sm <= s78;
when s78 => sm <= s79;
when s79 => sm <= s80;
when s80 => sm <= s81;
when s81 => sm <= s82;
when s82 => sm <= s83;
when s83 => sm <= s84;
when s84 => sm <= s85;
when s85 => sm <= s86;
when s86 => sm <= s87;
when s87 => sm <= s88;
when s88 => sm <= s89;
when s89 => sm <= s90;
when s90 => sm <= s91;
when s91 => sm <= s92;
when s92 => sm <= s93;
when s93 => sm <= s94;
when s94 => sm <= s95;
when s95 => sm <= s96;
when s96 => sm <= s97;
when s97 => sm <= s98;
when s98 => sm <= s99;
when s99 => sm <= s100;
when s100 => sm <= s101;
when s101 => sm <= s102;
when s102 => sm <= s103;
when s103 => sm <= s104;
when s104 => sm <= s105;
when s105 => sm <= s106;
when s106 => sm <= s107;
when s107 => sm <= s108;
when s108 => sm <= s109;
when s109 => sm <= s110;
when s110 => sm <= s111;
when s111 => sm <= s112;
when s112 => sm <= s113;
when s113 => sm <= s114;
when s114 => sm <= s115;
when s115 => sm <= s116;
when s116 => sm <= s117;
when s117 => sm <= s118;
when s118 => sm <= s119;
when s119 => sm <= s120;
when s120 => sm <= s121;
when s121 => sm <= s122;
when s122 => sm <= s123;
when s123 => sm <= s124;
when s124 => sm <= s125;
when s125 => sm <= s126;
when s126 => sm <= s127;
when s127 => sm <= s128;
when s128 => sm <= s129;
when s129 => sm <= s130;
when s130 => sm <= s131;
when s131 => sm <= s132;
when s132 => sm <= s133;
when s133 => sm <= s134;
when s134 => sm <= s135;
when s135 => sm <= s136;
when s136 => sm <= s137;
when s137 => sm <= s138;
when s138 => sm <= s139;
when s139 => sm <= s140;
when s140 => sm <= s141;
when s141 => sm <= s142;
when s142 => sm <= s143;
when s143 => sm <= s144;
when s144 => sm <= s145;
when s145 => sm <= s146;
when s146 => sm <= s147;
when s147 => sm <= s148;
when s148 => sm <= s149;
when s149 => sm <= s150;
when s150 => sm <= s151;
when s151 => sm <= s152;
when s152 => sm <= s153;
when s153 => sm <= s154;
when s154 => sm <= s155;
when s155 => sm <= s156;
when s156 => sm <= s157;
when s157 => sm <= s158;
when s158 => sm <= s159;
when s159 => sm <= s160;
when s160 => sm <= s161;
when s161 => sm <= s162;
when s162 => sm <= s163;
when s163 => sm <= s164;
when s164 => sm <= s165;
when s165 => sm <= s166;
when s166 => sm <= s167;
when s167 => sm <= s168;
when s168 => sm <= s169;
when s169 => sm <= s170;
when s170 => sm <= s171;
when s171 => sm <= s172;
when s172 => sm <= s173;
when s173 => sm <= s174;
when s174 => sm <= s175;
when s175 => sm <= s176;
when s176 => sm <= s177;
when s177 => sm <= s178;
when s178 => sm <= s179;
when s179 => sm <= s180;
when s180 => sm <= s181;
when s181 => sm <= s182;
when s182 => sm <= s183;
when s183 => sm <= s184;
when s184 => sm <= s185;
when s185 => sm <= s186;
when s186 => sm <= s187;
when s187 => sm <= s188;
when s188 => sm <= s189;
when s189 => sm <= s190;
when s190 => sm <= s191;
when s191 => sm <= s192;
when s192 => sm <= s193;
when s193 => sm <= s194;
when s194 => sm <= s195;
when s195 => sm <= s196;
when s196 => sm <= s197;
when s197 => sm <= s198;
when s198 => sm <= s199;
when s199 => sm <= s200;
when s200 => sm <= s201;
when s201 => sm <= s202;
when s202 => sm <= s203;
when s203 => sm <= s204;
when s204 => sm <= s205;
when s205 => sm <= s206;
when s206 => sm <= s207;
when s207 => sm <= s208;
when s208 => sm <= s209;
when s209 => sm <= s210;
when s210 => sm <= s211;
when s211 => sm <= s212;
when s212 => sm <= s213;
when s213 => sm <= s214;
when s214 => sm <= s215;
when s215 => sm <= s216;
when s216 => sm <= s1;
end case;
end if;
end process;


seg <= "011000001100111101101" when sm = s1 else
"011001100111111111001" when sm = s2 else
"001111101100001101101" when sm = s3 else
"001111110110110011111" when sm = s4 else
"110110111110010110000" when sm = s5 else
"111100101100001101101" when sm = s6 else
"011001101100110110000" when sm = s7 else
"011000010110110011111" when sm = s8 else
"001111101100111111001" when sm = s9 else
"011000011011010011111" when sm = s10 else
"110110111011011101101" when sm = s11 else
"101101111110010110011" when sm = s12 else
"111100101100111111001" when sm = s13 else
"001111101100110110000" when sm = s14 else
"011000011110011011011" when sm = s15 else
"101101111011011101101" when sm = s16 else
"001111110110110110000" when sm = s17 else
"111100101100001011011" when sm = s18 else
"101101111110010011111" when sm = s19 else
"011001101100000110000" when sm = s20 else
"101101110110110011111" when sm = s21 else
"111100111011010011111" when sm = s22 else
"110110111110011111001" when sm = s23 else
"011000010110111101101" when sm = s24 else
"011001100111110110011" when sm = s25 else
"011000001100111111001" when sm = s26 else
"110110101100000110011" when sm = s27 else
"001111100111111111001" when sm = s28 else
"110110100111111111001" when sm = s29 else
"111100110110110011111" when sm = s30 else
"011000010110110110000" when sm = s31 else
"110110101100110011111" when sm = s32 else
"001111110110110110011" when sm = s33 else
"111100100111110110011" when sm = s34 else
"011001111110010110000" when sm = s35 else
"111100101100110011111" when sm = s36 else
"101101100111110110011" when sm = s37 else
"101101101100000110000" when sm = s38 else
"001111111011010011111" when sm = s39 else
"110110101100111111001" when sm = s40 else
"110110101100001011011" when sm = s41 else
"101101111110010110000" when sm = s42 else
"011000011011010110011" when sm = s43 else
"001111111011011101101" when sm = s44 else
"011000001100110011111" when sm = s45 else
"011001111011011111001" when sm = s46 else
"011000001100001011011" when sm = s47 else
"111100111110011111001" when sm = s48 else
"111100111011011111001" when sm = s49 else
"011001110110111011011" when sm = s50 else
"110110100111110011111" when sm = s51 else
"101101111110011101101" when sm = s52 else
"011000001100000110000" when sm = s53 else
"111100110110111101101" when sm = s54 else
"011001111110010011111" when sm = s55 else
"110110110110111111001" when sm = s56 else
"101101100111111101101" when sm = s57 else
"011000011011011011011" when sm = s58 else
"101101101100001111001" when sm = s59 else
"011000000111111101101" when sm = s60 else
"101101101100000011111" when sm = s61 else
"111100110110110110000" when sm = s62 else
"001111111110011101101" when sm = s63 else
"011000001100110110011" when sm = s64 else
"011001111011010110000" when sm = s65 else
"110110111110011101101" when sm = s66 else
"111100101100000011111" when sm = s67 else
"101101111110011111001" when sm = s68 else
"111100100111111101101" when sm = s69 else
"011000011110010011111" when sm = s70 else
"011001101100110110011" when sm = s71 else
"101101110110110110000" when sm = s72 else
"111100111110010110000" when sm = s73 else
"101101111011010011111" when sm = s74 else
"110110110110111101101" when sm = s75 else
"011000001100000011111" when sm = s76 else
"001111111011010110011" when sm = s77 else
"101101111110011011011" when sm = s78 else
"111100100111111111001" when sm = s79 else
"110110111110010110011" when sm = s80 else
"001111101100110011111" when sm = s81 else
"011000011011011101101" when sm = s82 else
"011001101100000110011" when sm = s83 else
"101101101100110110000" when sm = s84 else
"011001111110010110011" when sm = s85 else
"001111110110111101101" when sm = s86 else
"011000001100001101101" when sm = s87 else
"110110111110010011111" when sm = s88 else
"011000010110111111001" when sm = s89 else
"011001101100000011111" when sm = s90 else
"110110111110011011011" when sm = s91 else
"111100110110111111001" when sm = s92 else
"001111101100001011011" when sm = s93 else
"110110111011010011111" when sm = s94 else
"001111111110010110011" when sm = s95 else
"011001100111110110000" when sm = s96 else
"110110111011010110011" when sm = s97 else
"111100111110011101101" when sm = s98 else
"111100101100110110011" when sm = s99 else
"101101101100110011111" when sm = s100 else
"011000011110010110000" when sm = s101 else
"011001100111111011011" when sm = s102 else
"111100101100000110011" when sm = s103 else
"101101110110111101101" when sm = s104 else
"011000001100001111001" when sm = s105 else
"001111101100111011011" when sm = s106 else
"111100100111110011111" when sm = s107 else
"101101111011010110011" when sm = s108 else
"110110100111110110000" when sm = s109 else
"111100111110011011011" when sm = s110 else
"001111111011011111001" when sm = s111 else
"011000001100000110011" when sm = s112 else
"101101110110111011011" when sm = s113 else
"111100100111110110000" when sm = s114 else
"101101101100111111001" when sm = s115 else
"110110100111111011011" when sm = s116 else
"001111111110011111001" when sm = s117 else
"011000011011010110000" when sm = s118 else
"101101100111110011111" when sm = s119 else
"001111101100110110011" when sm = s120 else
"011001101100001101101" when sm = s121 else
"111100110110111011011" when sm = s122 else
"001111111110010011111" when sm = s123 else
"101101100111110110000" when sm = s124 else
"011000011011011111001" when sm = s125 else
"110110101100000110000" when sm = s126 else
"101101101100111101101" when sm = s127 else
"111100101100000110000" when sm = s128 else
"001111100111110011111" when sm = s129 else
"110110110110110110011" when sm = s130 else
"001111101100001111001" when sm = s131 else
"011001110110110110000" when sm = s132 else
"101101111011011111001" when sm = s133 else
"111100111110010011111" when sm = s134 else
"001111100111111101101" when sm = s135 else
"011000011110010110011" when sm = s136 else
"011001110110111111001" when sm = s137 else
"001111111011011011011" when sm = s138 else
"011000011110011101101" when sm = s139 else
"111100101100110110000" when sm = s140 else
"111100111011010110011" when sm = s141 else
"011001101100001011011" when sm = s142 else
"110110101100110110000" when sm = s143 else
"011001111011011101101" when sm = s144 else
"001111110110111111001" when sm = s145 else
"011000000111110110011" when sm = s146 else
"110110111011010110000" when sm = s147 else
"011001101100001111001" when sm = s148 else
"001111111110010110000" when sm = s149 else
"110110100111111101101" when sm = s150 else
"001111101100000011111" when sm = s151 else
"111100110110110110011" when sm = s152 else
"011001100111111101101" when sm = s153 else
"101101110110111111001" when sm = s154 else
"110110101100000011111" when sm = s155 else
"011001111110011101101" when sm = s156 else
"011001101100111011011" when sm = s157 else
"101101101100001101101" when sm = s158 else
"011000000111110110000" when sm = s159 else
"011001110110110011111" when sm = s160 else
"101101101100110110011" when sm = s161 else
"111100111011011101101" when sm = s162 else
"001111101100000110011" when sm = s163 else
"001111100111111011011" when sm = s164 else
"110110101100110110011" when sm = s165 else
"011001111011010011111" when sm = s166 else
"001111101100111101101" when sm = s167 else
"111100111011011011011" when sm = s168 else
"011001101100111111001" when sm = s169 else
"110110110110110110000" when sm = s170 else
"011001111110011011011" when sm = s171 else
"101101110110110110011" when sm = s172 else
"001111111110011011011" when sm = s173 else
"110110100111110110011" when sm = s174 else
"101101101100111011011" when sm = s175 else
"011001111110011111001" when sm = s176 else
"011000001100111011011" when sm = s177 else
"101101111011010110000" when sm = s178 else
"111100100111111011011" when sm = s179 else
"110110111011011111001" when sm = s180 else
"001111100111110110011" when sm = s181 else
"011001110110111101101" when sm = s182 else
"101101100111111011011" when sm = s183 else
"111100111011010110000" when sm = s184 else
"001111110110111011011" when sm = s185 else
"101101101100000110011" when sm = s186 else
"011000000111111111001" when sm = s187 else
"110110110110110011111" when sm = s188 else
"011001101100111101101" when sm = s189 else
"101101101100001011011" when sm = s190 else
"001111100111110110000" when sm = s191 else
"111100101100001111001" when sm = s192 else
"011000010110111011011" when sm = s193 else
"001111111011010110000" when sm = s194 else
"011001100111110011111" when sm = s195 else
"110110101100001101101" when sm = s196 else
"011000001100110110000" when sm = s197 else
"110110111011011011011" when sm = s198 else
"101101100111111111001" when sm = s199 else
"110110110110111011011" when sm = s200 else
"111100111110010110011" when sm = s201 else
"110110101100111101101" when sm = s202 else
"011000000111111011011" when sm = s203 else
"111100101100111101101" when sm = s204 else
"011001111011011011011" when sm = s205 else
"011000011110011111001" when sm = s206 else
"011001110110110110011" when sm = s207 else
"111100101100111011011" when sm = s208 else
"110110101100001111001" when sm = s209 else
"101101111011011011011" when sm = s210 else
"011001101100110011111" when sm = s211 else
"011000010110110110011" when sm = s212 else
"001111101100000110000" when sm = s213 else
"110110101100111011011" when sm = s214 else
"011000000111110011111" when sm = s215 else
"011001111011010110011";


end archdice;
 
"Amstel" <lange360@hotmail.com> wrote in message
news:56f7756d.0310270805.76c619d6@posting.google.com...
I did an electronic dice game ( 3 die ) program in VHDL. Basically ,
the program has 216 different dice values combinations which was
simply assigned by me. The dice has 3 segment displays . I defined the
3 displays as output " seg " .
However , I can't figured out any idea to write this electronic dice (
3 die )program using the function " Random Number Generator " where
the dice can get random combinations randomly which means I don't have
to assign the 216 dice combintions .
Anyone have any idea how to write the program ?
You're nearly done.

You don't need any kind of random number generator. Just
make the clock run very fast (100 MHz ???) and add one more
input, an "Enable". Inside the state machine, wrap your
case statement in an "if" block:

if enable = '1' then
case sm
......... lots of stuff
end case;
end if;

Now connect "Enable" to a pushbutton. While this button
is down, the dice will roll - far too fast for the eye
to follow. When the button is released, the dice will
stop at a point which is essentially random, controlled
only by the exact moment of release of the button.

OK, that's the homework done. For a bit more credit, you
need to do two things:

(1) make your design and coding a lot more stylish; at the
moment, it's about as ugly as a sea cucumber's backside.
(2) think very, very carefully about why the "enable button"
scheme doesn't work well, and needs a lot of fixing.

The thread that you stimulated a couple of weeks ago, but
never contributed to again, would be a useful starting point.

Below is my program:
Small children, nursing mothers and others of nervous
disposition should avert their gaze at this point.

--

Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
(2) think very, very carefully about why the "enable button"
scheme doesn't work well, and needs a lot of fixing.
I was going some comment about metastability, but maybe
it's more fun to try to demonstrate setup/hold glitches.
It would be like real life when one of the die leans against
another one.

How would you build a system to maximize the chances of
screwing up? I think you want a state machine with
lots of illegal states and maybe lots of transitions
with many bits changing.

--
The suespammers.org mail server is located in California. So are all my
other mailboxes. Please do not send unsolicited bulk e-mail or unsolicited
commercial e-mail to my suespammers.org address or any of my other addresses.
These are my opinions, not necessarily my employer's. I hate spam.
 
Somehow , I'm required to write this electronic dice game program
using the
function " Random Number Generator " . It's part of a project
assignment and I have no choice .
I really need help on how to write the program using the " Random
Number Generator " .
Please . Anyone have any solutions ?

Thanks a lot .
 
"Amstel" <lange360@hotmail.com> wrote in message
news:56f7756d.0310271927.4ab2cdd7@posting.google.com...

Hi,

Somehow , I'm required to write this electronic dice game program
using the function " Random Number Generator " .
If you look back over the previous thread on this subject,
when you asked for help about two weeks ago, you will see lots
of very interesting discussion about how to use a random number
generator for this problem, and why it's somewhat difficult.
You will also find some very frivolous posts from me and others!

It's part of a project assignment and I have no choice.
I really need help on how to write the program using the " Random
Number Generator " .
What kind of random number generator? I have already offered
a suggestion for one way to make a random number generator,
based on human-driven sampling of a very fast counter. It
works well - I made an electronic die like this back in 1976
using four LSTTL chips, and seven LEDs. It even had a
touch-pad that you could press to roll the die - I think
I used a FET-input op amp for that.

Please . Anyone have any solutions ?
OK, here goes.

1) Make a nice big linear-feedback shift register to create
a pseudo-random stream of bits.
2) To roll the 3 dice, clock the shift register 8 times to get
8 random bits. (You can pick these bits from the top
8 flip-flops of the shift register; there's no need for
separate storage.)
3) If the numeric value of the 8 random bits is greater than 215,
go back to step 2 and keep trying until you get <=215.
4) Now you've got a numeric value in the range 0..215, decode it
onto the dice display using something similar to the huge and
disgusting selected assignment at the end of the code you
showed in your last post.

Steps (2) and (3) need a state machine. The same state
machine can also manage interaction with the user push-button
or whatever mechanism you use to demand a dice roll.

For the linear feedback shift register, how about a
20-bit shift register with taps 20 and 17 XOR'd together
and fed back to the input?
 
Jonathan Bromley wrote:
What kind of random number generator? I have already offered
a suggestion for one way to make a random number generator,
based on human-driven sampling of a very fast counter.
Jonathan - do you happen to know how fasible it is to
generate a random stream by sampling white noise with
an A->D converter. By feasible I mean a reasonable cost
level and a reasonable component count, though I guess
qualifying the resulting circuit is really the expensive
part of the job.

Somewhere in "The Art of Computer Programming" Knuth points
out that you cannot generate random numbers by randomly
choosing an algorithm ;-)
 
"Tim" <tim@rockylogic.com.nooospam.com> wrote in
message news:bnli77$j0i$1$8302bc10@news.demon.co.uk...

Jonathan - do you happen to know how fasible it is to
generate a random stream by sampling white noise with
an A->D converter. By feasible I mean a reasonable cost
level and a reasonable component count, though I guess
qualifying the resulting circuit is really the expensive
part of the job.
hi Tim,

sorry to disappoint but I have no experience of doing this.
I do know that people have used various kinds of active
device (zener diodes are a good candidate) to generate
noise that can be used to control a process randomly.
But I'd be very frightened that the sampling process would
introduce some systematic bias that I didn't know about,
and as you say the verification would be a nightmare.

Somewhere in "The Art of Computer Programming" Knuth points
out that you cannot generate random numbers by randomly
choosing an algorithm ;-)
Grin.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
Amstel wrote:
Somehow , I'm required to write this electronic dice game program
using the
function " Random Number Generator ".
What is this function, and how is it called ( params in /out) ?

In terms of applying RNG to your code, you could use
a script to generate 'next state' in a (semi) random basis
( it does need to be a monotonic thread )

You could also additionally 'randomize' the LED Table lookups
you have, but will again need to ensure a smoothed average
( all numbers 1-6 need to have equal ROM frequency )

Q: Will the resulting code create a 'better dice' ?

It would be more useable at lower clock frequencies.

-jg
 

Welcome to EDABoard.com

Sponsor

Back
Top