source: vis_dev/vis-2.1/examples/coherence/coherence.v @ 15

Last change on this file since 15 was 11, checked in by cecile, 13 years ago

Add vis

File size: 2.5 KB
Line 
1 `define address_size 0       // nb of bits - 1 of addressÊof blocs in memory
2 `define mem_size 1        // number of blocks in memory - 1
3
4 typedef enum {INVALID, SHARED, EXCLUSIVE} Block_status;
5 typedef enum { Ready, Rwait, Wwait, Rgrant, Wgrant} 
6    Cache_status;
7 typedef enum { COMPUTE, READ_WORD, WRITE_WORD } Instruction_type;
8 typedef enum { IDLE, READING, WRITING } Processor_state;
9 typedef enum { ONE, ONEWAIT,TWO, TWOWAIT, ONESERVE, TWOSERVE} Arbiter_status;
10// typedef enum { HIT,MISS,NOP} Cache_rwtype;
11 typedef enum {ok, blk_rreq, blk_excl, noop} Cache_reqstatus;
12
13// This is the main module
14// It has 3 types of sub,modules
15
16module COHERANCE(clk,
17  any_address1, any_value1,inst1,  //address, data, instruction for 1
18  any_address2, any_value2,inst2);
19
20
21input [`address_size:0] any_address1; 
22input [`address_size:0] any_address2; 
23input any_value1;
24input any_value2;
25input inst1;
26input inst2;
27input clk;
28
29
30wire acknowledge1;                        // output: to processor
31wire read_req1, write_req1, data1;           // input: requests from processor
32wire [`address_size:0] address1;           // input: requests from processor
33Instruction_type wire inst1;
34wire acknowledge2;                        // output: to processor
35wire read_req2, write_req2, data2;           // input: requests from processor
36wire [`address_size:0] address2;           // input: requests from processor
37Instruction_type wire inst2;
38wire back_data;
39 wire  blk_add1;
40 wire  blk_add2;
41 wire  blk_data;         
42 wire write_back_req1;
43 wire write_back_req2;
44 wire blk_ok1;
45 wire blk_ok2;
46 wire inval1;
47 wire inval2;
48 wire inval3;
49 wire   [`address_size:0] blocknum;         
50 wire wbr1;
51 wire wbr2; 
52 Cache_reqstatus wire cache_req1;         
53 Cache_reqstatus wire cache_req2;         
54
55
56PROC proc1(clk, read_req1, write_req1, data1, address1, acknowledge1, any_address1, any_value1, inst1);
57CACHE_CTRLER cc1(clk,read_req1, write_req1, data1, address1,acknowledge1,write_back_req1, inval1, blocknum,blk_ok1, blk_data,back_data1, cache_req1,blk_add1);
58
59PROC proc2(clk, read_req2, write_req2, data2, address2, acknowledge2, any_address2, any_value2, inst2);
60CACHE_CTRLER cc2(clk,read_req2, write_req2, data2, address2,acknowledge2,write_back_req2, inval2, blocknum,blk_ok2, blk_data,back_data2, cache_req2,blk_add2);
61
62DIRECTORY direc(clk,write_back_req1, inval1,write_back_req2, inval2,blocknum, blk_ok1, blk_data,blk_ok2, back_data1, cache_req1, blk_add1,back_data2, cache_req2, blk_add2);
63
64endmodule
65`include cache_ctrl.v
66`include processor.v
67`include directory.v
68
69
70
71
72
73
74
Note: See TracBrowser for help on using the repository browser.