annotate modules/bluespec/Pygar/lab4/BRegFile.bsv @ 60:6179c07c21d7
pygar svn.61
[svn r61] synthesis boundaries
author |
punk |
date |
Mon, 10 May 2010 20:29:20 -0400 |
parents |
92041177735c |
children |
90fa9b289aab |
rev |
line source |
rlm@8
|
1 import RegFile::*;
|
rlm@8
|
2 import RWire::*;
|
rlm@8
|
3 import ProcTypes::*;
|
rlm@8
|
4
|
punk@58
|
5 `include "asim/provides/low_level_platform_interface.bsh"
|
punk@58
|
6 `include "asim/provides/soft_connections.bsh"
|
punk@58
|
7 `include "asim/provides/fpga_components.bsh"
|
punk@58
|
8 `include "asim/provides/common_services.bsh"
|
punk@58
|
9
|
rlm@8
|
10 //-----------------------------------------------------------
|
rlm@8
|
11 // Register file module
|
rlm@8
|
12 //-----------------------------------------------------------
|
rlm@8
|
13
|
rlm@8
|
14 interface BRegFile #(type index_t, type data_t);
|
rlm@8
|
15 method Action upd(index_t addr, data_t data);
|
rlm@8
|
16 method data_t sub(index_t addr);
|
rlm@8
|
17 endinterface
|
rlm@8
|
18
|
punk@60
|
19
|
punk@60
|
20 (* doc = "synthesis attribute ram_style mkBRegFile distributed;" *)
|
punk@60
|
21 (* synthesize *)
|
rlm@8
|
22 module mkBRegFile(RegFile#(index_t, data_t))
|
rlm@8
|
23 provisos (Bits#(index_t, size_index),
|
rlm@8
|
24 Bits#(data_t, size_data),
|
rlm@8
|
25 Eq#(index_t),
|
rlm@8
|
26 Bounded#(index_t) );
|
rlm@8
|
27
|
punk@59
|
28 LUTRAM#(index_t, data_t) rf <- mkLUTRAMU_RegFile();
|
rlm@8
|
29 RWire#(Tuple2#(index_t, data_t)) rw <-mkRWire();
|
rlm@8
|
30
|
rlm@8
|
31 method Action upd (index_t r, data_t d);
|
rlm@8
|
32 rf.upd(r,d);
|
rlm@8
|
33 rw.wset(tuple2(r,d));
|
rlm@8
|
34 endmethod
|
rlm@8
|
35
|
rlm@8
|
36 method data_t sub (index_t r);
|
rlm@8
|
37 case (rw.wget()) matches
|
rlm@8
|
38 tagged Valid {.wr, .d} :
|
rlm@8
|
39 return (wr == r) ? d : rf.sub(r);
|
rlm@8
|
40 tagged Invalid : return rf.sub(r);
|
rlm@8
|
41 endcase
|
rlm@8
|
42 endmethod
|
rlm@8
|
43
|
rlm@8
|
44 endmodule
|