module mhash(clk,in,match); input clk; input [7:0]in;// integer i; reg [2:0] sum=3'b000; output reg match; reg [2:0] mem[7:0]; If we give the input value 10101010 for 'in', How to access bit by bit? I tried with in[0],in[1]...but I know its wrong. Is there any way?
Akshay E. wrote: > but I know its wrong. Where do you know this from? And WHAT error message do you get in WHICH line of WHATEVER code?
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 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
This my code..
and my output is
0 in=xxxxxxxx
Sum=000 xxxxxxxx x
10 in=10110101
Sum=100 10110101 1
Sum=000 10110101 1
Sum=100 10110101 1
Sum=000 10110101 1
Sum=100 10110101 1
Sum=000 10110101 1
Sum=100 10110101 1
Sum=000 10110101 1
Sum=100 10110101 1
The problem is, I gave the value 10101010 to test bench and it shows
in=10110101. Why?. and I am getting bit by bit values. I am sorry for
that.
My aim is to 'xor' all the mem[i] values to sum, for every in[i]=1
Akshay E. wrote: > This my code.. You did not hear anything about "indention" up to now? > i give 10101010 to test bench > input [7:0]in; > in=101010101; In fact you try to give 9 bits to an 8 bit vector...
Guest
#4001445
Akshay E. wrote:1 | |
In verilog, the default base for a number is 10, so 101010101 is
'd101010101 or 'h6054ab5. Truncate this to 8 bits you will get
8'b10110101
Akshay E. wrote:1 | |
This is what you get, so why are you surprised or sorry :-)? Maybe you really meant:
1 | |
Tschaebe
Reply
Please log in before posting.